Skip to main content

Module: components/provider/SCLocaleProvider

Variables

SCLocaleContext

Const SCLocaleContext: Context<SCLocaleContextType>

Creates Global Context

Context can be consumed in one of the following ways:
1. <SCLocaleContext.Consumer>{(locale,) => (...)}</SCLocaleContext.Consumer>
2. const scLocaleContext: SCLocaleContextType = useContext(SCLocaleContext);
3. const scLocaleContext: SCLocaleContextType = useSCLocale();

Defined in

packages/react-core/src/components/provider/SCLocaleProvider/index.tsx:27

Functions

SCLocaleProvider

SCLocaleProvider(children): JSX.Element

Description:

This component makes the intl available down the React tree.

Parameters

NameType
childrenObject
children.childrenReactNode

Returns

JSX.Element

<SCLocaleContext.Provider value={{locale, messages, selectLocale}}>

Defined in

packages/react-core/src/components/provider/SCLocaleProvider/index.tsx:38


useSCLocale

useSCLocale(): SCLocaleContextType

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

Returns

SCLocaleContextType

Defined in

packages/react-core/src/components/provider/SCLocaleProvider/index.tsx:110


withSCLocale

withSCLocale(Component): (props: any) => Element

Export hoc to inject the base theme to components

Parameters

NameType
Componentany

Returns

fn

▸ (props): Element

Parameters
NameType
propsany
Returns

Element

Defined in

packages/react-core/src/components/provider/SCLocaleProvider/index.tsx:97