Site icon Cody Paste

React Setup

Required:

Install

 

Step 1: Install React Router (For Navigate to pages:page link)
Open your terminal and navigate to your React project directory. Then, run the following command to install React Router:

 

Step 2: Install React Bootstrap and Bootstrap

You can install both react-bootstrap and bootstrap using npm. Open your terminal and run the following command in your project directory:

 

Now will setup

Step 1: First we will create a header, so create a folder ‘components‘ under the src folder:

and create a file Header.js (The first letter should be capitalised and extension could be js or JSX)

src/components/Header.js

 

Step 2: create 2 pages Home & About, so create a folder named ‘pages‘ under ‘src‘. here we will keep our pages. (you can choose any name in place of pages)

src/pages/About.jsx

src/pages/Home.jsx

 

Step 3: Now we have to import both pages and header in src/App.js App.js and index.js are our main files so every component has to import here

App.js

 

Step 4: Now we have to import bootstrap in src/index.js.

src/index.js

 

 

 

 

Exit mobile version