4 ms·
Also, if you _need_ SSR, rails might be a better approach. It's too bad the author didn't include it in the benchmark.
by spinlock 9y ago
Also, if you _need_ SSR, rails might be a better approach. It's too bad the author didn't include it in the benchmark.
- lucaspiller 9y agoWe did this recently with a small app that needs to be fast. The relatively simple page that you see when you first visit the site is rendered with plain old Rails, then when the user interacts with the page (based on DOM addEventListener hooks) it causes additional React components to be mounted and rendered. Originally I’d hoped to be able to render a basic version of the page with Rails, then ‘enhance’ it with React - ie render <button>For</button> with Rails, then when React has loaded, replace it with a React component. But I couldn’t find any details on using it this way, and given time constraints choose the simplest option.
- styfle 9y ago> then when React has loaded, replace it with a React component What you described is basically `hydrate` which is how to enable React event handlers like onClick after a server-side render. https://github.com/styfle/react-server-example-tsx/blob/4586f3431b4bfd424179da3aad2c6adbddb0de10/src/browser.tsx#L11 https://github.com/styfle/react-server-example-tsx/blob/4586...
- scaryclam 9y agoThis is something we've done in the past, and it works well. In fact, the ability to do this (usability is important to us so progressive enhancement is a lifesaver) is why we looked at react in the first place.