This component checks the user’s logged-in state and passes the data to the children components via context variables.


AuthProvider is an invisible component to wrap the whole application and detects if the current user has signed in. It stores the user state in a context variable and passes it to the children elements.

Context Variables

The context variables AuthProvider offers to the children components.

Prop NameDescription
authUserThe JSON object contains the user data. authUser.user contains the current user data if the user has signed in or null for users who haven’t signed in. is a JSON for custom data object you need to store for the current user. authUser.checked indicates if the status of the current user has been checked.
setAuthUserThis sets the authUser context variable.
fireabaseAppThis is the Firebase app variable that can be reused in the children components

Source Code