9951 explained code solutions for 126 technologies


reactjsHow do I create a new app with ReactJS?


To create a new app with ReactJS, follow the steps below:

  1. Install Node.js if it is not already installed.
  2. Install the create-react-app package by running npm install -g create-react-app in the command line.
  3. Create the React app by running create-react-app <app-name> in the command line.

Example code

npm install -g create-react-app
create-react-app my-app

Output example

Success! Created my-app at C:\Users\username\my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

We suggest that you begin by typing:

  cd my-app
  npm start

Happy hacking!

The create-react-app command will create a new directory with the name of the app and will generate all the necessary files for a basic React app.

The npm start command will start the development server and open the app in the browser. The npm run build command will create a production version of the app.

For more information, check out the Create React App documentation.

Edit this code on GitHub