AuthProvider¶
Import¶
Function Signature¶
AuthProvider<T
>({store: createStoreReturn<T>, children: React.ReactNode}
): ReturnType
<React.FC
>
React Provider that includes React Auth Kit functionality in your React Application.
Type Parameters¶
Name | Description | Type |
---|---|---|
T |
Type of User State Object | extends object |
Parameters¶
Name | Type | Required | Description |
---|---|---|---|
store |
createStoreReturn <T > |
Returned value from createStore function | |
children |
React.ReactNode |
React Component or Element |
Returns¶
ReturnType<React.FC>
React Functional component with React Auth Kit Recharged.
Remarks¶
Make sure you wrap your application as well as your router components in AuthProvider.
AuthProvider should be your Topmost element so that it can work effectively throughout the application.
Example¶
import AuthProvider from 'react-auth-kit';
import createStore from 'react-auth-kit/createStore';
const store = createStore();
<AuthProvider store={store}>
<RoutesComponent/>
</AuthProvider>
Defined in¶
packages/react-auth-kit/src/AuthProvider.tsx
— 🔑 —
React Auth Kit is MIT License code