import { createContext, Dispatch, FC, ReactNode, SetStateAction, useContext, useState, } from 'react'; interface LedCountContext { ledCount: number; setLedCount: Dispatch>; } const Context = createContext(undefined as any); export const LedCountProvider: FC<{ children: ReactNode }> = ({ children }) => { const [ledCount, setLedCount] = useState(0); return ( {children} ); }; export const useLedCount = () => useContext(Context);