Open wmertens opened 9 years ago
I think a fluxy-router would work well as a separate project. But let's leave this issue open so people can contribute some ideas here. Embracing immutability in routing is interesting.
Thought some more about this: The URL bar is like a different rendering context from the web page, with the normal React flow.
Changes to the Route Store (actions sending the user to a different URL or with different query parameters) should result "re-rendering" the URL bar, and user changes should result in Route Store updates, that can be ignored or augmented resulting in the URL bar and application both being re-rendered.
This is not much different than what react-router does but it's straightforward React, and not a magical DSL.
I'm trying to wrap my head around how an immutable store might be used to handle app state and URL handling. I don't really like the way react-router handles routing, it's rather opaque. I think I would prefer that react-router only handles browser history, url translation and scroll position, and an app-state store is used for everything. Then a user going to a URL would fire a "SET_APP_LOCATION" event with the path and parameters, which an action would translate into app-state and the store would set the browser location as a side effect. App-state undo then allows you to truly go back in the app state, opening and closing panels etc. Data in other stores would of course remain unchanged.
Not sure if this is a good idea. Opening this issue for discussion.