How to make Redux actions reducers load on demand!

Time:2022-5-27

background

A react router has been used in recent projects. Split the business into many modules, such as ABCD Module, react router can load these business codes on demand when it is suitable for the needs.
The data flow adopts redux. Actions and reducers have unified processing, as well as actions and reducers of each business module.

But, you will find that actions and reducers need to be defined at the beginning. In other words, the actions / reducers of business a cannot be loaded on demand, even if the user may not have access to business a at all. Assuming that your actions and reducers are very complex, your JS file is very large.

After looking online, it seems that there is no relevant information and ready-made solutions. That’s whyredux-async-actions-reducers

See for specific usage and demoredux-async-actions-reducers-demo