components/provider/SCContextProvider
Variables
SCContext
const
SCContext:Context
<SCContextType
>
Creates Global Context
Context can be consumed in one of the following ways:
1. <SCContext.Consumer>{settings => (...)}</SCContext.Consumer>
2. const scContext: SCContextType = useContext(SCContext);
3. const scContext: SCContextType = useSCContext();
Source
packages/react-core/src/components/provider/SCContextProvider/index.tsx:23
Functions
SCContextProvider()
SCContextProvider(
__namedParameters
):JSX.Element
This component imports all providers
Parameters
Parameter | Type |
---|---|
__namedParameters | SCContextProviderType |
Returns
JSX.Element
<SCContext.Provider value={{settings}}>
Source
packages/react-core/src/components/provider/SCContextProvider/index.tsx:34
useSCContext()
useSCContext():
SCContextType
Let's only export the useSCContext
hook instead of the context.
We only want to use the hook directly and never the context component.
Returns
Source
packages/react-core/src/components/provider/SCContextProvider/index.tsx:105