Skip to content
This repository was archived by the owner on Dec 15, 2018. It is now read-only.
This repository was archived by the owner on Dec 15, 2018. It is now read-only.

Add replaceRoutes on store #88

@etienne-dldc

Description

@etienne-dldc

Hi,

Have you ever though about a replaceRoutes method on the store ?
The case study I have in mind is code splitting. In fact this case study is not only in my mind :
I am working on a web app (Typescript / React / Redux) and I'm currently switching from react-router-redux to redux-little-router (because it will simplify a lot of stuff). With react-router the routes object wasn't split because react-router need all routes to boot.
So with redux-little-router, I can do the same thing but I feel that maybe a replaceRoutes is possible.
What we could get is something like this :

  • You first pass a initial route object to redux-little-router with one (or more) route ending with * (like myapp/private/*).
  • Then in the render that match this route, we fetch a some new routes, compute a new routes object by replacing the * by some sub routes and then call store.replaceRoutes(newRoutes) that replace the route object internally and dispatch a route event.

This would allow to:

  • expose only public routes of the app
  • isolate routes in each split part.
  • make hot reloading possible

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions