import { createContext, useContext, useState } from "react";

const LoaderContext = createContext();

export const LoaderProvider = ({ children }) => {
  const [isLoaderShown, setIsLoaderShown] = useState(true); // Initially true

  return (
    <LoaderContext.Provider value={{ isLoaderShown, setIsLoaderShown }}>
      {children}
    </LoaderContext.Provider>
  );
};

export const useLoader = () => useContext(LoaderContext);