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.

  • Type Parameters

    • P extends object

    Parameters

    Returns FC<P>