Posts

Showing posts from June, 2022

React

React: npx create-react-app my-react-app cd my-react-app npm start How to create the route in React js: npm latest version:  npm install -g npm@latest npm i react-router-dom Folder structure: Within the src folder, we'll create a folder named components with several files:  Home.js Blogs.js Contact.js      In index.js add the below line: import { BrowserRouter } from 'react-router-dom' ; const root = ReactDOM . createRoot ( document . getElementById ( 'root' )); root . render (   < React.StrictMode >     < BrowserRouter >       < App />     </ BrowserRouter >   </ React.StrictMode > );         In  App.js  paste this code: import { Routes , Route } from 'react-router-dom' import Home from './components/Home' import Blog from './components/Blog' import Contact from './components/Contact' function App () {     return ( ...