From 253f5e800d8c7ee596c09fc964014011279f3935 Mon Sep 17 00:00:00 2001 From: Christina Grannas Date: Wed, 5 May 2021 21:13:19 +0200 Subject: [PATCH] Update hooks.md Negating nullcheck of divRef.current --- docs/basic/getting-started/hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basic/getting-started/hooks.md b/docs/basic/getting-started/hooks.md index 29ecc4d2..d3ca09b8 100644 --- a/docs/basic/getting-started/hooks.md +++ b/docs/basic/getting-started/hooks.md @@ -153,7 +153,7 @@ function Foo() { useEffect(() => { // Note that ref.current may be null. This is expected, because you may // conditionally render the ref-ed element, or you may forgot to assign it - if (divRef.current) throw Error("divRef is not assigned"); + if (!divRef.current) throw Error("divRef is not assigned"); // Now divRef.current is sure to be HTMLDivElement doSomethingWith(divRef.current);