Skip to main content

Module: components/provider/SCUserProvider

Variables

SCUserContext

Const SCUserContext: Context<SCUserContextType>

SCUserContext (Authentication Context)

Context can be consumed in one of the following ways:
1. <SCUserContext.Consumer>{(user, session, error, loading, logout) => (...)}</SCUserContext.Consumer>
2. const scUserContext: SCUserContextType = useContext(SCUserContext);
3. const scUserContext: SCUserContextType = useSCUser();

Defined in

packages/react-core/src/components/provider/SCUserProvider/index.tsx:48

Functions

SCUserProvider

SCUserProvider(children): JSX.Element

Description:

This component keeps current user logged and session; it is exported as we need to wrap the entire app with it

Parameters

NameType
childrenObject
children.childrenReactNode

Returns

JSX.Element

<SCUserContext.Provider value={contextValue}>{!state.loading && children}</SCUserContext.Provider>

Defined in

packages/react-core/src/components/provider/SCUserProvider/index.tsx:59


useSCUser

useSCUser(): SCUserContextType

Let's only export the useSCUser hook instead of the context. We only want to use the hook directly and never the context component.

Returns

SCUserContextType

Defined in

packages/react-core/src/components/provider/SCUserProvider/index.tsx:294