Skip to content

Commit efb6291

Browse files
docs: throw when ref.current is null (#413)
1 parent 846474f commit efb6291

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: docs/basic/getting-started/hooks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function Foo() {
153153
useEffect(() => {
154154
// Note that ref.current may be null. This is expected, because you may
155155
// conditionally render the ref-ed element, or you may forgot to assign it
156-
if (divRef.current) throw Error("divRef is not assigned");
156+
if (!divRef.current) throw Error("divRef is not assigned");
157157

158158
// Now divRef.current is sure to be HTMLDivElement
159159
doSomethingWith(divRef.current);

0 commit comments

Comments
 (0)