Skip to content

Commit b093a12

Browse files
committed
update custome hook exercise
1 parent f93e126 commit b093a12

File tree

1 file changed

+13
-4
lines changed
  • src/components/patterns/Hooks/exercise_custom

1 file changed

+13
-4
lines changed

src/components/patterns/Hooks/exercise_custom/index.jsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,27 @@ const Bonus = () => {
1717
<code>useState</code> and <code>useEffect</code> Hooks.
1818
</p>
1919
<p>
20-
Tip: to remove the event listeners we need to use the clean up phase of
21-
the effect. To clean up the side effects you must return a function.
20+
Tip: to remove the event listeners we need to use the{" "}
21+
<a
22+
href="https://reactjs.org/docs/hooks-effect.html#effects-with-cleanup"
23+
target="_blank"
24+
>
25+
{" "}
26+
cleanup phase
27+
</a>{" "}
28+
of the effect. To clean up the side effects you must return a function.
2229
</p>
2330
<p>
2431
Documentation about custom hooks{" "}
2532
<a href="https://reactjs.org/docs/hooks-custom.html">
2633
https://reactjs.org/docs/hooks-custom.html
2734
</a>
2835
</p>
36+
<h4>Part 2</h4>
2937
<p>
30-
Import your useWidth and replace the hardcoded{" "}
31-
<code>const width = 3</code> at the top with{" "}
38+
import your useWidth in{" "}
39+
<code>src/patterns/Hooks/exercise_custom/index.jsx</code> and replace
40+
the &lt;Width /&gt; component with the width from
3241
<code>const width = useWidth()</code>
3342
</p>
3443

0 commit comments

Comments
 (0)