What are they?
A set of functions that provide a direct API to methods we access on Component instances. We can create stateful componen...
For further actions, you may consider blocking this person and/or reporting abuse
Why do you pass the setters to the second param of the
useEffect()?Good spot Pablo! In that case, it's not necessary and they could be omitted 👍
The docs almost discourage using an empty Array for the optional dependencies list and
eslint-plugin-react-hooks'sexhaustive-depsrule will in most cases pipe up when usinguseEffect. That's because in most cases, our effect usesprops+statefrom the component scope. There's a good piece on using the empty Array and why better solutions are normally the way to go here 👍I think using an empty array looks cleaner and more readable.
Yeah, definitely 👍 But it seems to be discouraged if the effect in question makes use of props + state in the component's scope.
Thanks
No problem Moataz! 😊
Good article thanks!
Thanks Allan! 😊