@ducor/react
Version:
admin template ui interface
17 lines (16 loc) • 555 B
JavaScript
import { useContext } from "react";
import { SidebarContext } from "../provider/sidebar";
/**
* Custom hook to manage sidebar state.
*
* @returns {SidebarContextType} An object containing sidebar state and functions to change the state.
* @throws Will throw an error if the hook is used outside of a SidebarProvider.
*/
var useSidebar = function () {
var context = useContext(SidebarContext);
if (!context) {
throw new Error("useSidebar must be used within a SidebarProvider");
}
return context;
};
export default useSidebar;