Module: components/provider/SCThemeProvider
Variables
SCThemeContext
• Const
SCThemeContext: Context
<SCThemeContextType
>
Creates Global Context
Context can be consumed in one of the following ways:
1. <SCThemeContext.Consumer>{(theme,) => (...)}</SCThemeContext.Consumer>
2. const scThemeContext: SCThemeContextType = useContext(SCThemeContext);
3. const scThemeContext: SCThemeContextType = useSCTheme();
Defined in
components/provider/SCThemeProvider/index.tsx:28
Functions
SCThemeProvider
▸ SCThemeProvider(children
): JSX.Element
Description:
This component makes the theme
available down the React tree.
It should preferably be used at the root of your component tree.
See: https://mui.com/system/styled/
Parameters
Name | Type |
---|---|
children | Object |
children.children | ReactNode |
Returns
JSX.Element
<SCThemeContext.Provider value={{theme, setTheme: setCustomTheme}}>
<ThemeProvider theme={theme}>{children}</ThemeProvider>
</SCThemeContext.Provider>
Defined in
components/provider/SCThemeProvider/index.tsx:44
useSCTheme
▸ useSCTheme(): SCThemeContextType
Let's only export the useSCTheme
hook instead of the context.
We only want to use the hook directly and never the context component.
Returns
Defined in
components/provider/SCThemeProvider/index.tsx:89
withSCTheme
▸ withSCTheme(Component
): (props
: any
) => Element
Export hoc to inject the base theme to components
Parameters
Name | Type |
---|---|
Component | any |
Returns
fn
▸ (props
): Element
Parameters
Name | Type |
---|---|
props | any |
Returns
Element