DEV Community

LAKSHMI G
LAKSHMI G

Posted on

Create React App (CRA) vs Vite – What They Are and How to Use Them

Create React App (CRA)?

  • Create React App is an officially supported way to create single-page React applications

  • It is help to a modern build setup with no configuration.

Advantage

  • Easy to start it is help to beginners.

  • Stable and widely used in older projects.

Disadvantage

  • Slower build times (Webpack).
  • Less flexible for customization.
  • Becoming outdated compared to modern tools.

Create React App commands

npx create-react-app my-app(Create a new React app,)
cd my-app(Move into the project folder)
npm start(Start the development server)

npx

npx ( Node Package eXecute)

  • It comes with npm (v5.2.0 and above).
  • It allows you to run Node.js packages directly from the command line without installing them globally.

cd (stands for Change Directory)

  • It is a Linux/Unix/Windows command used to move between folders in your terminal (command line).
  • why we this enter a project folder before running commands

Install npm in linux:
npm Node Package Manager (comes with Node.js).

  • sudo apt install npm - command for installing the npm
  • npm install -gnpm@latest -command for installing the latest version of npm globally

Version check commands

  • If you have the check npm version commands is npm -v
  • If you have the check node version commands is node -v

vite

  • Its is provide a faster and leaner development for web projects
  • It doesn’t need bundling while you’re coding, so the development server starts much faster.

Vite commands
npm create vite@latest my-app
cd my-app
npm install
npm run dev

Top comments (0)