React Router Navigation
github.com
2
Leaving SiteNav
External Link Disclaimer
You are about to visit github.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
React Router is a free and open-source declarative routing library for React applications. Originally created by Ryan Florence and Michael Jackson (also the creators of React Training and Remix) in 2014, React Router is the most widely used routing solution for React, used by virtually every React application with multiple pages. Key features: declarative routing: routes are defined declaratively using JSX components (Route path='/about' element={<About />}). The routing configuration is co-located with the component tree, making it easy to understand the application structure. Nested routes: routes can be nested, enabling hierarchical layouts where child routes render inside parent route components via the Outlet component. This eliminates manual prop drilling for layout components. Dynamic routing: route parameters (path='/users/:userId') enable dynamic URL segments accessed via useParams(). Optional parameters, splat routes (path='*'), and query strings (useSearchParams) are supported. Data Router (v6.4+): the new data API (loader, action) enables route-level data loading and mutations, inspired by Remix. Loaders fetch data before rendering the route, and actions handle form submissions. Navigation: useNavigate for programmatic navigation, Link for declarative navigation, NavLink for active link styling. Navigation blocking: useBlocker for preventing navigation (e.g., unsaved changes confirmation). History: integrates with the browser History API (createBrowserRouter) or hash-based routing (createHashRouter). Memory router for testing. Route guards: loader functions can redirect unauthenticated users. Error boundaries: errorElement for route-level error handling. Code splitting: lazy-load route components with React.lazy. Scroll restoration. JavaScript/TypeScript. MIT.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike