For react-router-dom
v6, simply replace Redirect
with Navigate
import { Navigate } from 'react-router-dom';
.
.
.
{ component: () => <Navigate to="/404" /> }
More Related Contents:
- react router v6 navigate outside of components
- Problem in redirecting programmatically to a route in react router v6
- React doesn’t reload component data on route param change or query change
- Uncaught TypeError: Cannot read property ‘push’ of undefined (React-Router-Dom)
- Multiple Nested Routes in react-router-dom v4
- ReactJS: [Home] is not a component. All component children of must be a or
- How to create a protected route with react-router-dom?
- How can I redirect in React Router v6?
- How to render an array of objects in React?
- Nested routes with react router v4 / v5
- Pass props in Link react-router
- How do I render components with different layouts/elements using react-router-dom v6
- React Router with optional path parameter
- Use anchors with react-router
- React react-router-dom pass props to component
- Active link with React-Router?
- ReactJS – Pass props with Redirect component
- Using anchor tags in react-router 4
- How to hide navbar in login page in react router
- How do you pass data when using the navigate function in react router v6
- How do I reload a page with react-router?
- How is this type annotation working in React code without TypeScript?
- React-router: How to manually invoke Link?
- React-router – How to pass data between pages in React?
- React-router v4 – cannot GET *url*
- Why I receive blank page? React
- using history with react-router-dom v6
- Detect change in query param react-router-dom v4.x and re-render component
- How to restrict access to routes in react-router?
- React – How to open PDF file as a href target blank