withIsAuthenticated¶
Deprecated Higher-order components are not commonly used in modern React code, use Hooks instead
Import¶
Function Signature¶
withIsAuthenticated<P
>(Component
): React.FunctionComponent
<P
>
Type Parameters¶
Name | Type | Description |
---|---|---|
P |
extends withAuthHeaderProps |
Props of the component |
Parameters¶
Name | Type | Description |
---|---|---|
Component |
ComponentType <P > |
React Class based Component |
Returns¶
React.FunctionComponent
<P
>
React Higher Order Component with injected isAuth
prop
React HOC that injects the authentication state into the class-based component props
Example¶
class MyComponent extends React.Component {
render() {
return <h1>Hello, {this.props.isAuth}</h1>;
}
}
export default withIsAuthenticated(MyComponent);
Throws¶
AuthError - Thrown if the Hook is used outside the Provider Scope.
Defined in¶
higherOrderComponents/withIsAuthenticated.tsx
— 🔑 —
React Auth Kit is MIT License code