React front end?

How would I go about adding React to my front end?
Do I scrap all the views that I currently built with html & css?

Installation is pretty easy if you already have Webpacker installed.

https://github.com/rails/webpacker/blob/master/docs/integrations.md#react

I’m not sure how this would interact with the existing app.

You definitely don’t have to scrap your existing views, in fact if you’re adding react I highly recommend that you only introduce react components for parts of your views that require holding state and executing javascript.

react-rails (GitHub - reactjs/react-rails: Integrate React.js with Rails views and controllers, the asset pipeline, or webpacker.) has a great guide on how to do everything you need.

2 Likes