DEV Community

Discussion on: React.js: The one way and the opposite way data flow

Collapse
 
ridhamz profile image
Ridha Mezrigui • Edited

context API is not a good solution here it is an over kill because if we use the SearchInput in many components we need many shared global states.

Collapse
 
anxiny profile image
Anxiny

Yes, if you only need to pass state change one or two levels or with very few children, pass setState as prop will be fine.

But, if you need to manage complex state, use Context API with useReduer hook in the container component will be easier to maintain and scale. Or use other state management lib like redux

Thread Thread
 
ridhamz profile image
Ridha Mezrigui

i agree