How to install in react project
React use javascript library for build front-end interfaces on UI. It is a free and open source.
Step 1: Node.js and npm Installation
Before you begin, make sure you have Node.js and npm (Node Package Manager) installed on your system. You can download and install them from the official Node.js website. npm is automatically installed with Node.js.
Step 2: Create a React App
- Using Create React App (Recommended):Create React App is an officially supported way to create a new React single-page application.bash
npx create-react-app my-react-app
Replace my-react-app
with your preferred project name.
Using Yarn (Optional):
If you prefer using Yarn, you can create a new React app using Yarn.
bash
yarn create react-app my-react-app
Step 3: Navigate to Your Project
Once your app is created, navigate into the project folder:
bash
cd my-react-app
Step 4: Run the Development Server
- Using npm:bash
npm start
Using Yarn:
bash
yarn start
Step 5: View Your React App
After starting the development server, open your browser and navigate to http://localhost:3000 (by default). You should see your React application up and running!
Additional Tips:
- Package Installation:
- To install additional packages or dependencies, use
npm install <package-name>
oryarn add <package-name>
.
- To install additional packages or dependencies, use
- Code Editor:
- Use a code editor like Visual Studio Code, Atom, or Sublime Text for a better development experience.
- Learning Resources:
- Utilize online tutorials, official React documentation, and community forums like Stack Overflow and Reddit to deepen your understanding of React and its ecosystem.
First You check what You need:-
1- Install the latest version of Windows
2- Install Windows Subsystem for Linux (WSL), including a Linux distribution (like Ubuntu).
3- Install Node.js on WSL 2: These instructions use Node Version Manager (nvm) for installation, you will need a recent version of NodeJS.
First Open a terminal(Windows Command Prompt) like cmd command.
Step -1 :-
npx create-react-app ProjectName
cd projectname
npm start
PORT change of Project
go root file
.env file and open write below code:-
PORT=5002
OR
package.json open file and write
"set PORT=3006 && react script start"