withAuth0 | @auth0/auth0-react (original) (raw)
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.