score:1

Accepted answer
const RoutesRender = ({ Routes, Key}) => {
  const History = useHistory();

  if (Routes.AuthRequired) {
    History.push('/auth/login');
    return null; // This is return value that is needed
  } else {
    return <Route exact key={Key} path={Routes.Path} render={(props) => <Routes.Component {...props} />} />;
  }
};

Related Query

More Query from same tag