Re:Introducing Hooks
by CuriouslyC on Thursday October 25, 2018 @03:23PM
(#18303771)
What do you do when you want to update state in other places in response to a change in a component? How about if you want to make your component's state persistent (particularly when the component is external to your project)? Also, what do you do to generate state dumps for error reporting?
> What do you do when you want to update state in other places in response to a change in a component?
In 90% of the cases one of the parent components. Sometimes redux when the component tree goes super deep, or for things such as currentUser.
> How about if you want to make your component's state persistent (particularly when the component is external to your project)
What do you mean? Give me an example.
> Also, what do you do to generate state dumps for error reporting?
I don't generate state dumps for error reporting.
Using Redux just to simply set and get data on every page is an overkill.
For the majority of applications making API calls directly from the component and storing data in the comp state is the way to go.
This is coming from someone who used redux excessively in the past.