What is the best way to redirect a page using React Router? [closed]
Actually it depends on your use case. 1) You want to protect your route from unauthorized users If that is the case you can use the component called <Redirect /> and can implement the following logic: import React from ‘react’ import { Redirect } from ‘react-router-dom’ const ProtectedComponent = () => { if (authFails) return … Read more