Skip to main content

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

Defined in

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

NameType
childrenObject
children.childrenReactNode

Returns

JSX.Element

<SCNotificationContext.Provider value={{wsInstance}}>{children}</SCNotificationContext.Provider>

Defined in

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

SCNotificationContextType

Defined in

packages/react-core/src/components/provider/SCNotificationProvider/index.tsx:46