nickjj / docker-rails-example

A production ready example Rails app that's using Docker and Docker Compose.
MIT License
941 stars 185 forks source link

Adding react #33

Closed dvogt23 closed 2 years ago

dvogt23 commented 2 years ago

Hey, thanks for your great job 🙂 trying to add react as descriped here: https://youtu.be/JsNtLiph87Y?t=586

But seems not that easy? 🤔 Anything else todo for adding react?

Just did ./run yarn:install react react-dom and import a jsx component to a view as described in video, but nothing...

greets dima

nickjj commented 2 years ago

Hi,

Instead of running yarn add react react-dom, you'll want to goto the package.json file and add both packages to the list of dependencies. Then once you have both defined you can do ./run yarn:install and you'll be good to go.

Alternatively if you really really want to use the yarn add command you can up everything and then run docker-compose exec js yarn add react react-dom which will update the package.json file and install things but that won't be built into the image for the next time which means you'd have to run ./run yarn:install afterwards.

Personally I'd just add both dependencies to the package.json file manually and run a ./run yarn:install.

Once you do the above you can import and start using React.

dvogt23 commented 2 years ago

Thank you for quick respose, it works :)