|
1
|
import { useContext } from "react" |
|
2
|
import { SidebarContext } from "./sidebar-context" |
|
3
|
|
|
4
|
export const useSidebar = () => { |
|
5
|
const context = useContext(SidebarContext) |
|
6
|
|
|
7
|
if (!context) { |
|
8
|
throw new Error("useSidebar must be used within a SidebarProvider") |
|
9
|
} |
|
10
|
|
|
11
|
return context |
|
12
|
} |