Clean • Professional
Before you start building applications with React, you need to set up your development environment. This includes installing Node.js, a package manager, and creating a React project using tools like Vite or Create React App (CRA).
Node.js is required to run JavaScript outside the browser and is essential for React development.
node -v
npm -v
React projects require a package manager to manage libraries and dependencies. You can use either:
npm (comes with Node.js by default)
npm install <package-name>
Yarn (alternative package manager, faster dependency management)
npm install --global yarn
yarn add <package-name>
You can set up a React project using Create React App (CRA) or Vite.
CRA is the traditional way to start a React project.
npx create-react-app my-app
cd my-app
npm start
Vite is a newer tool that builds faster and has a smaller bundle size.
npm create vite@latest my-app
cd my-app
npm install
npm run dev
Use Visual Studio Code (VS Code) for React development.
Version control is essential for real projects.
git --version
git init
git add .
git commit -m "Initial commit"
After creating your project, open it in the browser to ensure everything works. You should see the React welcome page if setup is successful.