Discussion: Implementing more complex re-initialization behavior
Closed this issue · 7 comments
Sometime we need reuse initialState, sometimes currentApp state (for https://github.com/reactjs/react-router-redux for example)
This is just inform issue, to be discussed.
@steida how is it hard to make reusable? You can use this reducer instead of writing your own, just like described in the stackoverflow post. It will send a @@redux-recycle/INIT
action and undefined
state (unless you define your own as a third argument)
Check usage in Este, sometimes we need initialState, sometimes current state. https://github.com/este/este/blob/0af0e5c826d850514441c12244670bd8636f3d30/src/common/configureStore.js#L92
@steida I see, well in this case you need to write your own higher-order reducer, redux-recycle is just a small utility function to re-initialize the state on an action 😉
I'll leave this open for discussion, though.
I agree, I just want to write somewhere 😅 that sure you can use this for an inspiration only ;)