From efc3958ba3a90db837dfdad4fd1f4323e1ce7196 Mon Sep 17 00:00:00 2001 From: Hao Dong <1476807+h-dong@users.noreply.github.com> Date: Mon, 12 Aug 2019 07:31:32 +0100 Subject: [PATCH] Added missing function bracket in hooks-effect.md (#2207) --- content/docs/hooks-effect.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/docs/hooks-effect.md b/content/docs/hooks-effect.md index 142dd6756..86b3b6649 100644 --- a/content/docs/hooks-effect.md +++ b/content/docs/hooks-effect.md @@ -131,6 +131,7 @@ function Example() { useEffect(() => { document.title = `You clicked ${count} times`; }); +} ``` We declare the `count` state variable, and then we tell React we need to use an effect. We pass a function to the `useEffect` Hook. This function we pass *is* our effect. Inside our effect, we set the document title using the `document.title` browser API. We can read the latest `count` inside the effect because it's in the scope of our function. When React renders our component, it will remember the effect we used, and then run our effect after updating the DOM. This happens for every render, including the first one.