-
Notifications
You must be signed in to change notification settings - Fork 755
Using redux with react-rails and server rendering? #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
react-rails and ReduxThe main issue I found when integrating react-rails and flux/redux is managing application state. In redux I'd like to have a single application state serialized from the server and parsed in the client, and to use that state to initialize the main store. Something like:
But that won't work since react-rails splits its work to 2 phases: it first reads all .js files in the renderer initialize phase and every call to the view helper only calls render. Solution is described below by using a new renderer that:
I'm not sure it's the best solution or how to generalize it, so any feedback is welcomed. |
@ynonp the gist link only works for you |
sorry, fixed |
Were you able to successfully use redux with react-rails? We are also facing similar issues. |
All, we've got this working using https://github.com/shakacode/react_on_rails/. We're about to put in the example of https://github.com/shakacode/react-webpack-rails-tutorial/ using the gem. We're using this in 3 commercial projects. We're about to have this working with react + redux + react-router + server rendering plus rails in the tutorial. It's not so much of a tutorial but a sample. Please feel free to reach me directly if you need more info. PR's on the shakacode projects are desirable! |
justin808 your live demo at http://www.reactrails.com/ does most of the rendering client-side (using view source I can't see the comments). Is this the project you refer to ? Is there another link? |
@ynonp We just haven't put that in yet...If you want to make that pull request, I can help you. No reason it shouldn't work. We're planning on it. This is an example: https://github.com/shakacode/react_on_rails/tree/master/spec/dummy |
https://github.com/shakacode/react_on_rails is READY with Redux + Server Rendering + Webpack. |
@justin808 for just starting out with this, I feel react_on_rails + tutorial is too 'everything all at once'. |
@NullVoxPopuli You're either going to use react-rails or react_on_rails, or you can just do I used to with some build scripts that put the JS file in the Rails, as I used to do. |
react-rails (2.4.7) I need to somehow |
Can you take a look at this comment? |
Has anybody gotten the redux library to work with server rendering?
I want to see how it compares to what I've got at https://github.com/shakacode/react_on_rails/
It seems that server rendering really should take a function that takes props rather than a component.
This is what we've got (CC: @alexfedoseev)
https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/client/app/startup/ServerApp.jsx
The text was updated successfully, but these errors were encountered: