UNPKG

@selfcommunity/react-core

Version:

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

37 lines (35 loc) 1.04 kB
import { SCCategoryType, SCUserType } from '@selfcommunity/types'; /** :::info This custom hook is used to manage the categories followed. ::: :::tip How to use it: Follow these steps: ```jsx 1. const scUserContext: SCUserContextType = useSCUser(); 2. const scFollowedCategoriesManager: SCFollowedCategoriesManagerType = scUserContext.manager.categories; 3. scFollowedCategoriesManager.isFollowed(category) ``` ::: */ export default function useSCFollowedCategoriesManager(user?: SCUserType, updateUser?: (info: any) => void): { categories: any[]; loading: any[]; isLoading: (v: number | { id: number; }) => boolean; follow?: undefined; isFollowed?: undefined; refresh?: undefined; emptyCache?: undefined; } | { categories: any[]; loading: any[]; isLoading: (v: number | { id: number; }) => boolean; follow: (category: SCCategoryType) => Promise<any>; isFollowed: (category: SCCategoryType) => boolean; refresh: () => void; emptyCache: () => void; };