Skip to main content

Module: components/provider/SCVoteProvider

Variables

SCVoteContext

Const SCVoteContext: Context<SCVoteContextType>

Creates Vote Context

Context can be consumed in one of the following ways:
1. <SCVoteContext.Consumer>{(reactions) => (...)}</SCVoteContext.Consumer>
2. const scVoteContext: SCVoteContextType = useContext(SCVoteContext);
3. const scVoteContext: SCVoteContextType = useSCVote();

Defined in

packages/react-core/src/components/provider/SCVoteProvider/index.tsx:27

Functions

SCVoteProvider

SCVoteProvider(children): JSX.Element

Description:

This component imports all reactions if the feature 'reaction' is enabled.

Parameters

NameType
childrenObject
children.childrenReactNode

Returns

JSX.Element

 <SCVoteContext.Provider value={{reactions}}>{!isLoading && children}</SCVoteContext.Provider>

Defined in

packages/react-core/src/components/provider/SCVoteProvider/index.tsx:38


useSCVote

useSCVote(): SCVoteContextType

Let's only export the useSCPreferences hook instead of the context. We only want to use the hook directly and never the context component.

Returns

SCVoteContextType

Defined in

packages/react-core/src/components/provider/SCVoteProvider/index.tsx:103