Create a React component in JavaScript. Create a component file called App in the src directory.
Create three parts. To begin, create a components directory and add the Home. js component to it.
In the App. js file, register the routes.
A Route> component will be used to identify each route. Two properties will be passed to the Route> component: path and component. It will return the component supplied if a path matches the route given to the Route> component.
Install react-router-dom in our application's root directory. Make the components we'll be rendering. From the react-router-dom API, import the BrowserRouter, Route, and Switch components. Wrap the App component with the BrowserRouter to enable routing functionality for the App.
React Router's most significant component is the Route component. If the current location fits the route's path, it displays some UI. A Route> component should ideally have a path prop, which is rendered if the path name matches the current location.
React Router isn't required in this situation. React Router, on the other hand, has a lot of navigational components that you can use to assemble your application declaratively, which may be quite beneficial for larger and more sophisticated navigational requirements in React apps. It's also excellent for React Native apps.
Learner's Ratings
4.4
Overall Rating
73%
11%
9%
1%
6%
Reviews
M
Mohanlal Khhurana
5
Very helpful course in learning ReactJS
A
Aditya
5
Amazing content.
S
Sonkar Singh
4
This series is usefull for just starting and building confident. Go further and explore more about React JS
S
Sumit Kumar
5
Fake reviews
M
Mahaveer kumar kirshanani
5
amazing mam , keep going
R
Rakeh
5
nice
A
Anshul Bhai
5
This is very helpful
Y
yash sheliya
5
My explaining in learnvern was good. Thank you for Learn Vern to all teachers
Share a personalized message with your friends.