0

I'm starting to learn React DOM. I'have installed all components correctly few days ago and my firt app used to work correctly.

Now I have a problem with render from src/app.js to public/scripts/app.js in my app. When I modify src/app.js - there is no rendering to public/scripts/app.js .

My live server is working correctly and is ready for changes, but when I save changes of src/app.js, that doesn't modify the public/scripts/app.js .

I'm on Windows..

Thanx for help.

Kalamarico
  • 5,466
  • 22
  • 53
  • 70
  • I found out the solution : in "myapp" folder run the commande : babel src/app.js --out-file=public/scripts/app.js --presets=env,react – Edyta Skibinska Jan 25 '18 at 12:04

1 Answers1

1

Your main file inside app.js inside scripts does not aware of the changes you make in the App.js file in src. React does not give this feature. You need to do it manually. For which You need to install Babel in your package.json file. Open terminal having the path of your file location and install Babel-Cli there.

npm install babel-cli --save

Now, open another terminal with your file location path and hit the command below:

babel src/App.js --out-file=public/scripts/app.js --presets=env,react -watch

Now leave this terminal as it is. It will transpile your ES6 javascript from src to scripts folder. Make sure to leave that terminal open while you are working. Hope this works.

Sagar Bajpai
  • 361
  • 1
  • 5
  • 13