Difference between revisions of "React Setup"

From rbachwiki
Jump to navigation Jump to search
Line 1: Line 1:
* Install Node
* Install Node
* React dev tools for Chrome (optional)
* React dev tools for Chrome (optional)
-- Setting up a react project --
=Setting up a react project=
  npm init -y #  
  npm init -y #  
  npm install react react-dom
  npm install react react-dom
Line 12: Line 12:
''' create an 'index.html and index.js' in the src folder ''' <br />
''' create an 'index.html and index.js' in the src folder ''' <br />


--initialize babel and webpack files --
=initialize babel and webpack files=
# on the root dir create a file  
# on the root dir create a file  
  .bablerc
  .bablerc

Revision as of 19:17, 10 February 2021

  • Install Node
  • React dev tools for Chrome (optional)

Setting up a react project

npm init -y # 
npm install react react-dom
npm install @babel/core babel-loader @babel/preset-env @babel/preset-react
npm install webpack webpack-cli webpack-dev-server

code . # will open visual studio code in that directory
Create a 'src' folder in the project folder

mkdir src

create an 'index.html and index.js' in the src folder

initialize babel and webpack files

  1. on the root dir create a file
.bablerc
npx create-react-app my-app # this does not install it globally
cd my-app
npm start

Check if npm is installed

npm --version