Loading lesson path
Concept visual
Start at both ends
To use React in production, you need npm which is included with Node.js. Also, you need to set up a React Environment, and choose a build tool.
First, make sure you have Node.js installed. You can check by running this in your terminal:
Formula
node - v
If Node.js is installed, you will get a result with the version number:v22.15.0 If not, you will need to install Node.js. Install a Build Tool (Vite) When you have Node.js installed, you can start creating a React application by choosing a build tool.
Vite build tool in this tutorial. Run this command to install Vite:
Formula
npm install - g create - vite
If the installation was a success, you will get a result like this:added 1 package in 649ms
Formula
Run this command to create a React application named my - react - appFormula
npm create vite@latest my - react - app -- -- template react
If you get this message, just press yand press
Need to install the following packages:
Formula
create - vite@6.5.0Ok to proceed? (y) If the creation was a success, you will get a result like this: > npx
Formula
> create - vite my - react - app -- template react| o
Formula
Scaffolding project in C:\Users\stale\my - react - app...|
Done. Now run:
Formula
cd my - react - app npm install npm run devAs the result above suggests, navigate to your new react application directory:
Formula
cd my - react - appAnd run this command to install dependencies: npm install
added 154 packages, and audited 155 packages in 8s 33 packages are looking for funding run npm fund for details found
vulnerabilities
Now you are ready to run your first real React application!
Formula
Run this command to run the React application my - react - appnpm run dev
VITE v6.3.5 ready in 217 ms â
http://localhost:5173/ â Network: use --host to expose â
Formula
press h + enter to show helpA new browser window will pop up with your newly created React App! If not, open your browser and type localhost:5173 in the address bar.