-
Notifications
You must be signed in to change notification settings - Fork 114
Usage without React #176
Comments
Hey @eirslett, I'm actively considering this for the next release–will let you know if/how we decide to make a split 👍 |
Same 👍 I am building a Vanilla JS project with Redux state management; no React view layer is required since my views are Vanilla. I too, like the premise of your article for building this router, would like to remove the router's dependency on the view thereby storing the URL within the Redux state. But since this router requires React I'm back to bundling React into my build to support Fragment and Link, both of which I will not use. Can you recommend a quick way to decouple these? |
@tptee is there a timeline for the next release? |
This can be accomplished in the same way we handle Ideally, we would remove the |
Just emphasizing the issue: The following is not what one wants to see when needing a modern router while avoiding React:
In our case React is out of the question because we depend heavily on another lib that already implements a virtual DOM. |
We would definitely consider a pull request modeled after what we did for Check out the files in ‘src/immutable’ for something analogous to what I think the end solution would look like. |
Oh, and to the original issue, we do now provide So this issue presently means "you get some warnings" and is not something more serious like "your frontend bundle is bigger than it should be" if you are using a modern bundler like |
For you who are looking for a short-term solution, here is one that builds on the tip about entrypoints by @ryan-roemer... Okay, so first I had:
Not working. Without
But when I change the code to use the entrypoints the following works:
Not pretty, not intuitive, and will break if the internal file structure of |
Believe it or not, some people use Redux without using React.
(One example case is with brownfield projects)
Could the setup of this project be refactored a bit, so that the React-specific helpers are optional?
I'm using Webpack, and it complains that it needs the react-redux dependency, which is not relevant if you're not using React, so it's just extra bloat. (And then again, maybe React-redux depends on React so suddenly you're sitting there with the whole React dependency just for a little redux router...)
Either
(two entry points in the npm package)
or
(two npm packages)
Also, if the
import/export
statements aren't compiled, but kept in the output bundle (maybe with a jsnext:main/module flag, Webpack and Rollup might be able to tree-shake away the unneeded code. (I'm not sure whether it would be able to tree-shake away the react-redux dependency though)The text was updated successfully, but these errors were encountered: