Function withAuth0

  • class MyComponent extends Component {
    render() {
    // Access the auth context from the `auth0` prop
    const { user } = this.props.auth0;
    return <div>Hello {user.name}!</div>
    }
    }
    // Wrap your class component in withAuth0
    export default withAuth0(MyComponent);

    Wrap your class components in this Higher Order Component to give them access to the Auth0Context.

    Providing a context as the second argument allows you to configure the Auth0Provider the Auth0Context should come from f you have multiple within your application.

    Type Parameters

    Parameters

    Returns ComponentType<Omit<P, "auth0">>