I need to move between these paths and get information from the url using custom React components
Payload uses the react-router directly, you should be able to use this hook
https://v5.reactrouter.com/web/api/Hooks/usehistoryHere you have payload's own hooks
https://payloadcms.com/docs/admin/hooks#useauthif you have custom components on routes you're responsible for handling the redirect based on auth
Here's an example though
import { Redirect } from "react-router-dom";
// ... inside component
if (!user || (user && !canAccessAdmin)) {
return <Redirect to={`${adminRoute}/unauthorized`} />;
}
Star
Discord
online
Get dedicated engineering support directly from the Payload team.