Summary: in this tutorial, you will learn how to create the React Hello World web application.
Prerequisites
Before you start working with ReactJS, you need to have Node.js and Node Package Manager (npm) installed on your computer.
First, open the command prompt on Windows or Terminal on Unix-like systems.
Second, run the following command to check the version of Node.js:
node --versionCode language: plaintext (plaintext)Output:
v21.3.0Code language: plaintext (plaintext)Creating a React project
First, open a terminal and run the following command:
npx create-react-app hello-worldCode language: plaintext (plaintext)This command will create a new directory named hello-world and set up the React project files and directories. It’ll take a few minutes because the command will create many files and directories.
Second, navigate to the project directory:
cd hello-worldCode language: plaintext (plaintext)Third, run the following command to start the React development server:
npm startCode language: plaintext (plaintext)This command will start the development and run the React application. It’ll launch the URL http://localhost:3000 in the web browser: