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();
Functions
SCVoteProvider()
SCVoteProvider(
children
):Element
Description:
This component imports all reactions if the feature 'reaction' is enabled.
Parameters
Parameter | Type | Description |
---|---|---|
children | { children : ReactNode ; } | |
children.children | ReactNode | - |
Returns
Element
<SCVoteContext.Provider value={{reactions}}>{!isLoading && children}</SCVoteContext.Provider>
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.