2 ms·
Well that's the goal, that you should not really care (too much) how it's exactly implemented to use it, right? It could be very simple or very complex, it coul
by franciscop 6y ago
Well that's the goal, that you should not really care (too much) how it's exactly implemented to use it, right? It could be very simple or very complex, it could be in Redux or a simple state hook. In the case of more serious side effects like if it persists through localStorage, you read it once (hopefully through some docs!) and then you know how to use it anywhere.
I agree with you that in the author use case it's waaay too simple and the best case is to use it inline, but I believe what they meant to do (hopefully!) is use that as an example of a potentially more complex hook and how you can/should use custom hooks instead of shoving all the logic in the component.
- pigcat 6y agoFair point.