Create React App
Written By: Avinash Malhotra
Updated on
How to install React JS
React JS installation is quite easy and can be done in many ways. We can install React using the old Create-react-app, vite or Next JS. In this article, we will go through react installation step by step. Make sure you have already installed Node JS.If not, Install Node JS first.
React can be installed in many ways. The first way was Create-react-app which was used till Feb 2025. After that vite was recommended to create react applications.
However if you want a Full Stack react Application with Server Side Rendering, Next.js is recommended.
Ways to install React
React can be installed by using following methods:
- Create React App (Deprecated)
- Vite (Recommended)
- Next JS (Recommended for SSR)
Create React App
Create React App (CRA) was the initial recommended tool to create React applications. It was officially deprecated in Feb 2025.
Create React App automatically installs React and adds boilerplate code. This includes a package.json, an App component, index.html, and other resources. It uses Webpack and Babel under the hood.
To install react using Create React App, type commands below in terminal or command prompt
npx create-react-app app-namecd app-namenpm startNow open http://localhost:3000/ to see your app.
function App() {
return (
<div>
<h1>Hello React!</h1>
<p>App created with create-react-app 🚀</p>
</div>
);
}
export default App;
Vite
Vite is the recommended way to use with React 19 in 2025 onwards. Vite a fast and use ESBuild/Rollup under the hood to gives instant startup.
vite is a build tool for modern React, Vue, Svelte etc. Vite consists of two parts:
- A dev server that offers advanced features over native ES modules, such as rapid Hot Module Replacement (HMR).
- A build command that bundles your code with Rollup, which outputs highly optimized static assets for production.
To install react using vite, type commands below in terminal or command prompt
npm create vite@latest my-app // choose react cd my-appnpm installnpm run devNow open http://localhost:5173/ to see your app.
For macos or linux, use sudo npm
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)
Next JS
Next.js is another recommended way to use react with a Full Stack Framework. Next.js will install both React and ReactDOM.
Next.js is a framework of react. It comes with extra features like ssr,
npx create-next-app@latest next-appcd next-appnpm run devVite Vs Create React App VS Next.js
Difference between Vite , Create React App and Next.js
CRA vs Vite vs Next.js — Comparison
Here is the differences between Create React App, Vite and Next.js.
| Features | CRA (Create React App) | Vite | Next.js |
|---|---|---|---|
| Setup | Simple, quick start | Very fast, lightweight setup | Easy but includes more features |
| Build Tool | Uses Webpack (slower) | Uses ESBuild/Rollup (super fast) | Uses Webpack (or Turbopack in newer versions) |
| Rendering | Client-Side Rendering only | Client-Side Rendering only | Supports CSR, SSR, SSG, ISR |
| Routing | Not included (add React Router) | Not included (add React Router) | Built-in file-based routing |
| SEO | Weak (content loads after JS) | Weak (content loads after JS) | Strong (SSR/SSG helps search engines) |
| Backend / API | Needs separate server | Needs separate server | Built-in API routes |
| Performance (Dev) | Slower dev builds, HMR can lag | Super fast dev server, instant HMR | Good dev experience, heavier than Vite |
| Learning Curve | Very beginner-friendly | Beginner-friendly | Moderate (needs SSR/SSG knowledge) |
| Best Use Case | Learning React, small apps, playgrounds | Small–medium apps, fast prototyping, modern SPAs | Production-ready apps, SEO-focused and scalable sites |