Using redux-thunk to combine reducer state

时间:2018-06-04 16:37:53

标签: reactjs redux react-redux redux-thunk

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!

1 个答案:

答案 0 :(得分:1)