Server rendering, how to run it in development? Should i?

Hi there, so I’ve already run the generator with the option to do server side rendering. I’ve deleted the client side bootstrap (not the webpack configs), as my plan is to make this a single page app that renders from the server quite well for initial page load.

However, when I run the procfile, it always seems to load the client side config. I see the procfile does the rebundling, and the server.js handles the webpack-dev-server and uses the hot config. So I’m wondering what the best practice is to test & use server rendering in development. I’d prefer to not use prender: Rails.env.production? in my react_component calls. I’d rather test it a head of time. Any suggestions on how best to proceed?

I don’t understand what you mean by removing the client side config. I’ve never tried using react with only server side rendering. If you’re going to do that, then you are better off using standard Rails rendering techniques with fragment caching.

If you’re only talking about how you handle bootstrap for CSS, then you can simply use Rails standard CSS capabilities.

Another alternative is to go all in on webpack and use CSS modules, as shown on http://www.reactrails.com.

You may be right on doing a more traditional rails app. I was thinking that each route would be server rendered essentially. Those would share common react components as need be. After first page load, react router would take care of the rest, and work like a single page app. If you think this is inadvisable, then I can simply go without it. Just wanted to see what would be needed to get server side working properly. It’s not uncommon to hear people talk about how many websites appear blank these days until the data is loaded through ajax. I can agree it’s a bit jarring, so I usually like to avoid it if I can.

This sounds like the standard behavior as shown in the code here: