import React, { Dispatch, SetStateAction, useMemo, useState } from "react"; const LoadingContext = React.createContext(null); type LoadingContextT = { loading: boolean; setLoading: Dispatch>; }; const LoadingProvider: React.FC = ({ children }) => { const [loading, setLoading] = useState(true); const value = useMemo(() => ({ loading, setLoading }), [ loading, ]); return ( {children} ); }; export { LoadingContext, LoadingProvider };