GitHub

Use React with Hotwire

It is a demo that shows how you can plug a react app inside a rails app using Stimulus.js.

If you start the app, and go to the "page with react" you will see a page with the counters implemented using react and started using a Stimulus controller.

By starting the react app with Stimulus.js you can then move back to the index, that don’t have any react component, and the go back to the page with react using turbo, and Stimulus.js will initialize the app as expected.

Like in this video…

Hotwire with react demo

Blog post

I wrote a blog post, explaining how you can integrate react with hotwire, using this repo as example.

You can find it on bhserna.com/use-react-with-hotwire.html

Versions

Ruby

  • Ruby: 3.0.0
  • Rails: 7.0.2.2
  • Turbo rails: 1.0.0
  • Stimulus rails: 1.0.2

Javascript

  • React: 17.0.2
  • React Dom: 17.0.2

Read the original on github.com ↗