Skip to main content

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

Source

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

ParameterTypeDescription
childrenobject
children.childrenReactNode-

Returns

JSX.Element

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

Source

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

Source

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