Skip to main content

Setup Options

The React ecosystem has evolved. The legacy create-react-app command is no longer recommended by the core React team due to slow compilation times and outdated dependencies.

Today, there are two primary approaches to initializing a React project.

1. Vite (Client-Side Rendering)

Vite is a modern, lightning-fast build tool. It is the immediate successor to Create React App for building standard Single Page Applications (SPAs). It uses native ES modules to compile code in milliseconds.

To create a new React project with Vite, run the following command in your terminal:

npm create vite@latest my-react-app -- --template react
cd my-react-app
npm install
npm run dev

2. Next.js (Server-Side Rendering)

If your application requires strong Search Engine Optimization (SEO), or if you need to build backend API routes directly alongside your frontend code, the React team officially recommends using a full-stack framework like Next.js.

Next.js pre-renders pages on the server before sending them to the browser, which vastly improves initial load times and SEO metrics.

To initialize a Next.js project:

npx create-next-app@latest my-next-app
cd my-next-app
npm run dev