简体   繁体   中英

Should the redux store keep only non-UI states?

I have a catalog store (redux) with categories and products. Based on the UI events (for example 'filtered' or a 'category' that has been collapsed), the UI state will change - a new state is derived from the catalog store.

In the redux ToDo example, the visibility filter is managed as part of the redux store. The filter is a UI state, and shouldn't that be managed part of the component states? So in my example, all the UI states handled in the components?

Keeping both "application" state and "UI" state in a Redux store is entirely reasonable. Ultimately, it's up to you what data you put in your store. See Redux FAQ for further discussion on this topic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM