-
Notifications
You must be signed in to change notification settings - Fork 384
Use Server Side Rendering #2
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
Hey, I just stumbled upon your tutorial as I have been meaning to try something similar. I think the Rails + React + Hot Loading + SSR would be absolutely killer if it can be configured without too much pain. Have you been able to make any progress towards this issue? It looks like we should take a closer look to |
Hi! We've got a small group of like minded folks chatting on Slack every day about this technology setup. However, we're all busy on other client projects as well. If you could try to see you could make this work, that would be awesome! Email me directly if you wish. |
I will see what I can do |
Any progress on this? |
I have not tried. I think that in order to make this work the logic of loading only from the REST apis would have to get modified so the entire rendering could happen synchronously. |
I'm currently on it though admittedly I'm doing it outside the scope of Rendering the component is actually not the hardest part, it's much more I'm currently working with flummox and a separate node server that renders On Monday, March 16, 2015, Justin Gordon [email protected] wrote:
|
I think a great solution would be is to have this codebase enhanced with
|
Totally agreed. It just becomes quite complex in nature. I was initially On Monday, March 16, 2015, Vladimir Reshetnikov [email protected]
|
Hey guys, after tinkering a bit, I unfortunately wasn't able to incorporate my work into this repo, but for anyone's interested in making SSR work, I created this example https://github.com/nambrot/rails-webpack-react-flux. Dealing with node was quite a pain. |
As @nambrot wrote that he doesn't recommend the approach he came up with in his experiment, did someone else maybe got pre-rendering to work in a nice way with the setup of this tutorial? |
I'm going to work on this later today. |
Here's my first attempt at getting server-side rendering to work - I forked from this repo and created a branch for experimenting with this. I use the react-rails gem. It seems to work. However, I am sure there are cases that still needs to be handled. |
I ran into this case: reactjs/react-rails#319 @nikhilbaradwaj You seem to be using the react-rails jsx processing. I want to leave all that stuff to webpack. |
Everything is compiled by Webpack. You can comment out all the config for react-rails compilation and I think it will still work. components.js only points to an already compiled client-bundle.js. Regarding the issue you ran into - The react-rails readme has the following note under server-side rendering section- |
@nikhilbaradwaj We can probably screen share (screen hero). My email is listed on my profile. |
@nikhilbaradwaj you can put calls to methods which access the DOM into |
@justin808 Sure, I'll be online tonight between 10pm - 12am EST. Thanks. |
We're getting close. This will probably go in with Redux as well. This is roughly how we're doing it: https://github.com/justin808/react_server_side_rendering_webpack/tree/redux-on-rails-server |
Nice! |
@justin808 I can't wait server side rendering! |
Very cool! 👏 My concern now is about routing. If I want to use Client routes and server routes I will have to duplicate it. Right? Also If I've a router as a Top Level Component I'll need to be able to render it on the server with the right route. What about making work React Router + Rails + Webpack? There is a gem to make work React Router + Rails + Asset pipeline https://github.com/mariopeixoto/react-router-rails |
@samnang and I plan to work on the gem for the rendering this weekend. We're crazy busy on a new AMAZING startup, also with @alexfedoseev Medium article on Isomorphic React with Rails. If any of you know anybody interested in working with these technologies, get in touch! |
got it working for a Gem: https://github.com/shakacode/react_on_rails |
Getting close! I published an alpha version here: https://rubygems.org/gems/react_on_rails |
I plan to tackle this in the next few days. |
@andresgutgon we're almost ready to allow server side rendering with redux/react/react-router once we use the new version of the react-router API. @mapreal19 Please try out the shakacode/react_on_rails#20 with this example. You can configure bundler to use this branch. And then boom server rendering. CC: @josiasds, @alexfedoseev, @dylangrafmyre We should have the next version of the react_on_rails gem published within a few days. |
@andresgutgon, the https://github.com/mariopeixoto/react-router-rails is based on the react-rails gem. Our preferred technique is webpack for JS code and not gemifying the JS assets. |
@justin808 I know. For that I'm moving to a Express (node) app for server side rendering. This way I have only one routing system on server/client (react-router). That was some of my requirements. Anyway thank you for this project. It's great |
@andresgutgon You'll soon see that an express node app is not your only option. We're using a react-router type setup within Rails pages. |
Good 💪 In the meantime for me is a good experience learn node and setup an universal app with that stack |
@alexfedoseev @dylangrafmyre @mapreal19 @josiasds @samnang I want to get this live by this weekend. @dylangrafmyre I believe you were working on this, and @alexfedoseev has some changes as well. |
Once this is done, let's be sure to put in a comment here: reactjs/react-rails#143 to let react-rails folks know that we got this working. |
@justin808 Yep, gonna merge my branch this weekend. |
Finished a while ago! |
ReactJs supports server side rendering. The react-rails gem. Let's make this example also demonstrate how to do that.
The text was updated successfully, but these errors were encountered: