components/provider/SCNotificationProvider
Variables
SCNotificationContext
const
SCNotificationContext:Context
<SCNotificationContextType
>
Creates Global Context
Context can be consumed in one of the following ways:
1. <SCNotificationContext.Consumer>{(wsInstance, subscribe,) => (...)}</SCNotificationContext.Consumer>
2. const scNotificationContext: SCNotificationContextType = useContext(SCNotificationContext);
3. const scNotificationContext: SCNotificationContextType = useSCNotification();
Source
packages/react-core/src/components/provider/SCNotificationProvider/index.tsx:23
Functions
SCNotificationProvider()
SCNotificationProvider(
children
):JSX.Element
Description:
This component makes the notification context available down the React tree.
Parameters
Parameter | Type | Description |
---|---|---|
children | object | |
children.children | ReactNode | - |
Returns
JSX.Element
<SCNotificationContext.Provider value={{wsInstance}}>{children}</SCNotificationContext.Provider>
Source
packages/react-core/src/components/provider/SCNotificationProvider/index.tsx:34
useSCNotification()
useSCNotification():
SCNotificationContextType
Let's only export the useSCNotification
hook instead of the context.
We only want to use the hook directly and never the context component.
Returns
Source
packages/react-core/src/components/provider/SCNotificationProvider/index.tsx:46