Setting up a React project with the “Create React App” package
Subscribe to my email newsletter for the latest tutorials, tips, and more!
Create React App allows you too quickly set up a React app with a single terminal command.
It’s great for when you want to jump in and start coding without having to mess around with configuration.
The only prerequisite is to have a recent version (8.10+) of Node.js installed.
To get started open terminal and run the
npx create-react-app hello-world
hello-world with your project name.
Once the installation is complete switch to the newly created directory and start the project:
cd hello-world && npm start
This will open the below page in a browser on a live development server at localhost:3000.
At this point you can make code edits and the project will automatically recompile and reload the browser.
If for some reason the live reloading isn’t working for you try running the following command:
npm cache clean --force
That concludes the setup, when your app is ready for deployment run the following command:
npm run build
This will create a new “build” folder in the project with the optimised code and assets to deploy.