DEV Community

Avinash Kumar
Avinash Kumar

Posted on

How to create a React app for a complete Beginner

To create a React app as a complete beginner, you will need to have Node.js and npm (the Node.js package manager) installed on your computer. Once you have these prerequisites installed, follow these steps:

  1. Open a terminal or command prompt and navigate to the directory where you want to create your React app.

  2. Run the following command to create a new React app:

npx create-react-app my-app
Enter fullscreen mode Exit fullscreen mode

This will create a new directory called "my-app" with the necessary files for a basic React app.

  1. Navigate into the new "my-app" directory and start the development server by running the following command:
cd my-app
npm start
Enter fullscreen mode Exit fullscreen mode

This will start the development server and automatically open your default browser to http://localhost:3000/. You should see a "Welcome to React" message on the page.

  1. To edit your React app, open the "my-app" directory in a code editor of your choice. You can make changes to the code and the development server will automatically reload the page to reflect your changes.

  2. When you are ready to build your app for production, run the following command:
    npm run build

    This will create a "build" directory with optimized versions of your app's files. You can deploy these files to a web server to make your app available to the public.

Congratulations, you have created your first React app! To learn more about React and how to build more complex applications, check out the official React documentation and tutorials.

Top comments (0)