import { Dispatch, SetStateAction, createContext, useContext, useState } from 'react' type UnreadsType = { [key: string]: number } type Context = { unreads: UnreadsType setUnreads: Dispatch> } const UnreadsContext = createContext({ unreads: {}, setUnreads: (_: UnreadsType) => {} }) UnreadsContext.displayName = 'UnreadsContext' export const useUnreads = () => { return useContext(UnreadsContext) } type Props = { children: React.ReactNode } export const UnreadsProvider: React.FC = ({ children }) => { const [unreads, setUnreads] = useState({}) return {children} }