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();
Functions
SCNotificationProvider()
SCNotificationProvider(
children
):Element
Description:
This component makes the notification context available down the React tree.
Parameters
Parameter | Type | Description |
---|---|---|
children | { children : ReactNode ; } | |
children.children | ReactNode | - |
Returns
Element
<SCNotificationContext.Provider value={{wsInstance}}>{children}</SCNotificationContext.Provider>
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.