UNPKG

@selfcommunity/react-core

Version:

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

37 lines (35 loc) 1.2 kB
import React from 'react'; import { SCNotificationContextType } from '../../../types'; /** * Creates Global Context * :::tip Context can be consumed in one of the following ways: ```jsx 1. <SCNotificationContext.Consumer>{(wsInstance, subscribe,) => (...)}</SCNotificationContext.Consumer> ``` ```jsx 2. const scNotificationContext: SCNotificationContextType = useContext(SCNotificationContext); ``` ```jsx 3. const scNotificationContext: SCNotificationContextType = useSCNotification(); ```` ::: */ export declare const SCNotificationContext: React.Context<SCNotificationContextType>; /** * #### Description: * This component makes the notification context available down the React tree. * @param children * @return * ```jsx * <SCNotificationContext.Provider value={{wsInstance}}>{children}</SCNotificationContext.Provider> * ``` */ export default function SCNotificationProvider({ children }: { children: React.ReactNode; }): JSX.Element; /** * Let's only export the `useSCNotification` hook instead of the context. * We only want to use the hook directly and never the context component. */ export declare function useSCNotification(): SCNotificationContextType;