Dynamically load redux reducers with react router 4

前端 未结 3 761
离开以前
离开以前 2021-02-04 09:10

I\'m splitting my code based on components and I want to inject my reducers only when a component loads, rather than stacking them all up from the start in the store.

I

3条回答
  •  死守一世寂寞
    2021-02-04 10:14

    You could inject not only reducers but also sagas, load pages by chunks and make your components really in competent way with its own css and assets (images, icons) no thing global everything is dynamically attached to app. There is a whole philosophy about it - atomic design, and here is a boilerplate which pursues a similar idea:

    https://github.com/react-boilerplate/react-boilerplate

    I realize my answer is not sufficiently complete answer but it may give more idea for the next steps.

提交回复
热议问题