File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/components/patterns/Hooks/exercise_custom Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -17,18 +17,27 @@ const Bonus = () => {
17
17
< code > useState</ code > and < code > useEffect</ code > Hooks.
18
18
</ p >
19
19
< 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.
22
29
</ p >
23
30
< p >
24
31
Documentation about custom hooks{ " " }
25
32
< a href = "https://reactjs.org/docs/hooks-custom.html" >
26
33
https://reactjs.org/docs/hooks-custom.html
27
34
</ a >
28
35
</ p >
36
+ < h4 > Part 2</ h4 >
29
37
< 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 <Width /> component with the width from
32
41
< code > const width = useWidth()</ code >
33
42
</ p >
34
43
You can’t perform that action at this time.
0 commit comments