I am currently writing, on a React app, a redux-thunk action that is not in any way asynchronous, but which allows me to get around the encapsulation of state generated by having different reducer functions (using combineReducers).
Basically, I needed to have an action that incorporated data from two different reducers, and I realized I could do this with a thunk (which I'm already using for async actions), using the getState parameter.
This allows me to handle what I'm guessing will remain an edge case without having to reconsider the encapsulation of my state.
My question is: should I be wary of this approach? Is this a bad practice in any way?
Thanks!
答案 0 :(得分:1)
That's just fine, and that's one of the approaches we suggest in the Redux FAQ entry on working with state slices.