I'm going over the hooks documentation and they make it very clear
The state of these components is completely independent. Hooks are a way to reuse stateful logic, not state itself.
I want to be clear on the difference between these two things.
That's saying that when you reuse a custom hook in multiple components, the actual state data will not be shared between those components. There will be a separate instance of the state data for each use of the hook.
If you do want to share the state, then you would be looking at using the useContext
hook (which could also be used in a custom hook which would then mean the multiple uses of the hook could share state).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With