React Basics
React Installation and Setup with Vite
Vite is the recommended way to start a React project in 2026. It creates a project in a few seconds, starts a dev server that reloads changes almost instantly, and produces a small optimised production bundle with a single build command.
What is Installation and Setup with Vite in React?
Vite is the recommended way to start a React project in 2026. It creates a project in a few seconds, starts a dev server that reloads changes almost instantly, and produces a small optimised production bundle with a single build command.
Why Installation and Setup with Vite matters
The older create-react-app tool is deprecated and noticeably slow on modest laptops. Vite gives you a faster feedback loop, which matters a lot while you are learning and saving a file every few seconds.
Installation and Setup with Vite example
npm create vite@latest my-app -- --template react
cd my-app
npm install
npm run devHow this works
The first command scaffolds a project using the React template. npm install downloads react, react-dom and the build tooling. npm run dev starts a local server, usually on http://localhost:5173, and reloads the browser whenever you save.
The other commands you will use
npm run build # production bundle into dist/
npm run preview # serve dist/ locally to check the build
npm install axios react-router-dom # add librariesKey points to remember
- Node.js 18 or newer is required — check with node -v.
- Use --template react-ts instead if you want TypeScript from day one.
- The dev server is for development only; deploy the contents of dist/.
- Install the React Developer Tools browser extension on day one.
Common mistakes with Installation and Setup with Vite
- Forgetting the extra -- before --template, which makes npm swallow the flag.
- Running npm run dev without npm install first.
- Creating the project inside a folder whose path contains spaces or non-English characters — some tools still trip on this.
React Installation and Setup with Vite— Interview Questions & FAQs
Should I use Vite or Create React App?+
Use Vite. Create React App is no longer maintained and its dev server is far slower. The React documentation itself now points beginners at Vite or a framework such as Next.js.
Do I need to install React globally?+
No. React is a project dependency installed by npm install into node_modules. Nothing about React needs a global install.
