UNPKG

@selfcommunity/react-core

Version:

React Core Components useful for integrating UI Community components (react-ui).

38 lines (35 loc) 1.07 kB
import React from 'react'; import { SCVoteContextType } from '../../../types/context'; /** * Creates Vote Context * :::tip Context can be consumed in one of the following ways: ```jsx 1. <SCVoteContext.Consumer>{(reactions) => (...)}</SCVoteContext.Consumer> ``` ```jsx 2. const scVoteContext: SCVoteContextType = useContext(SCVoteContext); ``` ```jsx 3. const scVoteContext: SCVoteContextType = useSCVote(); ```` ::: */ export declare const SCVoteContext: React.Context<SCVoteContextType>; /** * #### Description: * This component imports all reactions if the feature 'reaction' is enabled. * @param children * @return * ```jsx * <SCVoteContext.Provider value={{reactions}}>{!isLoading && children}</SCVoteContext.Provider> * ``` */ export default function SCVoteProvider({ children }: { children: React.ReactNode; }): JSX.Element; /** * Let's only export the `useSCPreferences` hook instead of the context. * We only want to use the hook directly and never the context component. */ export declare function useSCVote(): SCVoteContextType;