ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Why should you use prerender: false in most cases?


#1

In the React on Rails README it says,

In most cases, you should use the prerender: false (default behavior) with the provided helper method to render the React component from your Rails views. In some cases, such as when SEO is vital, or many users will not have JavaScript enabled, you can enable server-rendering by passing prerender: true to your helper, or you can simply change the default in config/initializers/react_on_rails.

I’m curious why you should use prerender: false in most cases? From my point of view it gives the user a better experience as there’s no need to wait for JS to kick in and render the component and the already mentioned SEO aspect. Am I missing anything?


#2

When you add prerender: true, you introduce a lot of complexity in your app and your setup. So get the basics working first. Then turn it on and see if you like it!