1

I am Making a simple app using create-react-app
but the server stops and won't update with changes
Plz Help

npm version 6.14.4
node version 10.19.0
Ubuntu 20.04 LTS
WSL 2 Windows 10 Home\

My Index.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

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

serviceWorker.unregister();

My app.js

import React from 'react';
import Palette from './Palette';
import seedColors from './seedColors'
import './App.css';

function App() {
  return (
    <div className ="App">
      <Palette colors ={seedColors[3]}/>
    </div>
  );
}

export default App;

My Palette.js

 import React, { Component } from "react";

 class Palette extends Component{
     render(){
         return(
             <div><h1>Palette</h1></div>
         )
     }
 }

 export default Palette

The seedColors.js ,I have taken from https://github.com/Colt/react-colors/blob/master/colors-app/src/seedColors.js

ASHUTOSH SINGH
  • 131
  • 1
  • 13

1 Answers1

1

Try adding a .env file to your root project directory (where you have package.json and node_modules). Then inside .env, add CHOKIDAR_USEPOLLING=true. This just worked for me when I was having issues with hot reloading not working. Apparently the "watcher" requires this setting when working with a VM (like WSL). I found this recommended in the top answer here: React create app hot reload is not always working on linux

Nolan Strait
  • 405
  • 4
  • 7
  • 1
    Thanks man this really helped me .. It is working now – ASHUTOSH SINGH Sep 04 '20 at 21:49
  • @ASHUTOSHSINGH, I'm glad that fixed things for you! Could you please upvote my answer and mark as accepted? I only have 1 reputation at the moment and would greatly appreciate the boost. – Nolan Strait Sep 08 '20 at 22:13