DEV Community

Michael Burrows
Michael Burrows

Posted on • Updated on • Originally published at w3collective.com

Setting up a React project with the “Create React App” package

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 create-react-app command:

npx create-react-app hello-world
Enter fullscreen mode Exit fullscreen mode

Replace 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
Enter fullscreen mode Exit fullscreen mode

This will open the below page in a browser on a live development server at localhost:3000.

Alt TextAt 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
Enter fullscreen mode Exit fullscreen mode

That concludes the setup, when your app is ready for deployment run the following command:

npm run build
Enter fullscreen mode Exit fullscreen mode

This will create a new “build” folder in the project with optimised code and assets to deploy.

Top comments (0)