Ruby on Rails + React.js Hot Reloading or Auto-refresh.

while working with ror as back-end and react.js as a front-end. i came cross the problem where i have to reload page every time i made change to any react component. so i dig up and came cross the solution.

gem install foreman

by this gem we will able to run both server at the same time. one for rails and one for web-packer as react.

after installation. go to your app root directory and make a name file with name Procfile without any extension

web: bundle exec rails s
webpacker: ./bin/webpack-dev-server

write these two commands in the file.

foreman start.

this will start your server on localhost:5000