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();

Functions

SCRoutingProvider()

SCRoutingProvider(children): Element

Description:

This component provides routing context.

Parameters

ParameterTypeDescription
children{ children: ReactNode; }
children.childrenReactNode-

Returns

Element

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

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