简体   繁体   中英

Using redux-thunk to combine reducer state

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!

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