ways to create a react app.

1 min read
// METHOD 1
npx create-react-app 01basicreact
// METHOD 2
npm create vite@latest
then provide project name: 01_basicvite
then choose REACT
then JAVASCRIPT
here npm is not installed by default: we need to run
-npm install
HOW TO RUN ?
goto folder -> cd 01basicreact
=> you must see package.json there. if you can see it->
npm run start
to run vite project:
goto vite folder via cd
then
npm run dev
if error comes: check node modules available/not in folder -> if not?
first run
.. npm install
METHOD 3 @USING PARSER
-> npm init
-> npm install -D parcel
-> npm install react
-> npm i react-dom //or npm install react-dom
-> npx parcel index.html // provide starting point
-> import this and good to go..with react
import React from "react";
import ReactDOM from "react-dom/client";
-> to build production build
npx parcel build index.html
add
"scripts": {
"start":"parcel index.html",
"build":"parcel build index.html",
"test": "jest"
},
"start":"parcel index.html",
"build":"parcel build index.html",
adding this script in package.json makes our life easier.
now we can run the app easily like..
- npm run start or npm start
npm run build
0
Subscribe to my newsletter
Read articles from Bhavik Bhuva directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
