withAuthenticationRequired | @auth0/auth0-react (original) (raw)

const MyProtectedComponent = withAuthenticationRequired(MyComponent);

When you wrap your components in this Higher Order Component and an anonymous user visits your component they will be redirected to the login page; after login they will be returned to the page they were redirected from.