React doesn't render my Component, only if I restart my project

I am trying Reactjs for the first time, but when want to render something, it only renders it when I restart my project. If I hit save, nothing happens. Have someone met with this problem yet?


import React from 'react';


function App(){
  return (
    <div>
      <h1>Hello React</h1>
      <button>Button</button>

    </div>
  );
}

export default App;
import React from 'react';
import ReactDOM from 'react-dom';


ReactDOM.render(<App />, document.getElementById('root'));

Upvotes: 1

Views: 892

Answers (1)

Sylens
Sylens

Reputation: 1177

If you want the app to render the latest changes you made to the source files, you have to implement hot-reloading.

Check this site for more info : https://gaearon.github.io/react-hot-loader/getstarted/

It will scan changes you do to the source files and automatically apply the changes to the running app. It will also make sure that the state of the app is not lost during this change.

Upvotes: 1

Related Questions