How to initialize a new React.js App in your local development environment

Last Updated on July 5, 2022

If you keep on forgetting how to create a new project in React.js, you are definitely not alone. I’m writing this post because I keep on forgetting it.

So to my future self, just follow the steps below to initialize a new React.js App.


Install the most recent version of Node.js. Installers can be found at

I prefer installing the LTS version of Node.js since this has longer support. You can check the Node.js version releases and end of life at


Test the Node.js installation by running the following commands.

node -v
npm -v

If this returns the version number of Node.js and npm then you have successfully installed Node.js.


Run the following command to initialize your ReactJS project.

npx create-react-app APP_NAME

Change the APP_NAME to your desired project name.

This will create a new folder with your APP_NAME.

The screenshot below is the folder structure inside the project named 01-first-react-app.

Newly created React project folder structure.


Test the newly created React App by running the command.

npm start

The terminal will show this output.

npm start compiled successfully.

It will also open a new browser showing the placeholder react content of the project.

Placeholder content of newly initialized ReactJS project.

This shows that we have successfully created a new ReactJS project.


Delete the contents of src folder and replace them with your app’s files.

cd src

# If you're using a Mac or Linux:
rm -f *

# Or, if you're on Windows:
del *

# Then, switch back to the project folder
cd ..

You may now start your React.js project.

Or create the git repository for this.

The following are the contents of some of the common files when creating a new React project.

Note: These files may change in the future. I’m just putting them here because I always check on these files.


# See for more about ignoring files.

# dependencies

# testing

# production

# misc



  "name": "01-first-react-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  "eslintConfig": {
    "extends": [
  "browserslist": {
    "production": [
      "not dead",
      "not op_mini all"
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"

# Getting Started with Create React App

This project was bootstrapped with [Create React App](

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests]( for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment]( for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](

To learn React, check out the [React documentation](

### Code Splitting

This section has moved here: [](

### Analyzing the Bundle Size

This section has moved here: [](

### Making a Progressive Web App

This section has moved here: [](

### Advanced Configuration

This section has moved here: [](

### Deployment

This section has moved here: [](

### `npm run build` fails to minify

This section has moved here: [](

I hope this helps. Let me know your experience or if my post is outdated in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *