UNPKG

@selfcommunity/react-core

Version:

React Core Components useful for integrating UI Community components (react-ui).

39 lines (35 loc) 1.08 kB
import React from 'react'; import { SCRoutingContextType } from '../../../types'; /** * Creates Global Context * :::tip Context can be consumed in one of the following ways: ```jsx 1. <SCRoutingContext.Consumer>{(routerLink, routes, url) => (...)}</SCRoutingContext.Consumer> ``` ```jsx 2. const scRoutingContext: SCRoutingContextType = useContext(SCRoutingContext); ``` ```jsx 3. const scRoutingContext: SCRoutingContextType = useSCRouting(); ```` ::: */ export declare const SCRoutingContext: React.Context<SCRoutingContextType>; /** * #### Description: * This component provides routing context. * @param children * @return * ```jsx * <SCRoutingContext.Provider value={contextValue}>{children}</SCRoutingContext.Provider> * ``` */ export default function SCRoutingProvider({ children }: { children: React.ReactNode; }): JSX.Element; /** * Let's only export the `useSCTheme` hook instead of the context. * We only want to use the hook directly and never the context component. */ export declare function useSCRouting(): SCRoutingContextType;