No need for state in React components if using Redux and React-Redux?

后端 未结 1 1659
谎友^
谎友^ 2021-01-11 10:34

Managing state with React only

I understand that if you\'re creating an application using React only, you will end up managing all of your state wit

1条回答
  •  北海茫月
    2021-01-11 11:19

    There are different opinions on this, but the general view seems to be that redux should only contain "application state". Individual react components like dropdowns or modals will still have their own state.

    There is still a lot of debate on this though, check out this issue for example about how to manage local component state: https://github.com/reactjs/redux/issues/159

    Some projects have been popping up that are trying to solve this "problem":

    • redux-react-local
    • recompose withReducer (more for reducer semantics for local, not global state)

    0 讨论(0)
提交回复
热议问题