When do I choose React state Vs Redux Store

If the state doesn’t need to be shared with other components, or the state doesn’t need to be keep when the component is unmounted, then you can just put it in the component’s state.

You can think that the Redux store is the database of front-end, if you have something like product data fetched from an API, then the Redux store is the right place; if you have a dropdown component, which takes a isOpen prop, then the parent of that dropdown can just keep dropdownIsOpen as a component state.

For more information, here is the answer from Dan: https://github.com/reactjs/redux/issues/1287

Also you said

only 1 container component and the rest of it as stateless component

This is incorrect. You can have several container components. A container component can also contain another container component.

Leave a Comment