The core React library does not provide a solution for routing.
You can write your own routing or use a routing library.
The most widely used library is react-router.
In this video Ill demonstrate how to install and use react-router and show you the most important features - defining routes navigating with the Link and NavLink component setting up a 404 page dynamic routes and the useParams hook using search query parameters with the useSearchParams hook and redirecting with the Navigate component and useNavigate hook.
Contents:
0:00 Introduction
0:25 Introducing the Demo App
0:35 Installing and Setting up Routes
1:30 Navigating with Links
1:20 The Solution: Context
1:59 Active State with NavLinks
2:31 404 Not Found Page
3:02 Dynamic Routes
3:45 The useParam Hook
4:06 Back Button
4:34 URL Search Parameters
5:15 Redirecting with the Navigate Component
5:32 Redirecting with the useNavigate Hook
6:09 Conclusion
Email: nikola.n.lazarovoutlook.com
Twitter:
LinkedIn:
react course
Источник: rutube.ru