Skip to main content

components/provider/SCRoutingProvider

Variables

SCRoutingContext

const SCRoutingContext: Context <SCRoutingContextType>

Creates Global Context

Context can be consumed in one of the following ways:
1. <SCRoutingContext.Consumer>{(routerLink, routes, url) => (...)}</SCRoutingContext.Consumer>
2. const scRoutingContext: SCRoutingContextType = useContext(SCRoutingContext);
3. const scRoutingContext: SCRoutingContextType = useSCRouting();

Source

packages/react-core/src/components/provider/SCRoutingProvider/index.tsx:40

Functions

SCRoutingProvider()

SCRoutingProvider(children): JSX.Element

Description:

This component provides routing context.

Parameters

ParameterTypeDescription
childrenobject
children.childrenReactNode-

Returns

JSX.Element

<SCRoutingContext.Provider value={contextValue}>{children}</SCRoutingContext.Provider>

Source

packages/react-core/src/components/provider/SCRoutingProvider/index.tsx:51


useSCRouting()

useSCRouting(): SCRoutingContextType

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

SCRoutingContextType

Source

packages/react-core/src/components/provider/SCRoutingProvider/index.tsx:141