Answers for "using react-router-dom to redirect using link"

1

react-router-dom redirect on click

import { useNavigate } from 'react-router-dom';
...
const navigate = useNavigate()
...
navigate('./create', { replace: true });
Posted by: Guest on December-08-2021
11

react redirect to url

import { Route, Redirect } from 'react-router'

<Route exact path="/" render={() => (
  loggedIn ? (
    <Redirect to="/dashboard"/>
  ) : (
    <PublicHomePage/>
  )
)}/>
Posted by: Guest on July-20-2020

Code answers related to "using react-router-dom to redirect using link"

Code answers related to "Javascript"

Browse Popular Code Answers by Language