1 import { useContext } from "react"
2 import { SearchContext } from "./search-context"
3
4 export const useSearch = () => {
5 const context = useContext(SearchContext)
6 if (!context) {
7 throw new Error("useSearch must be used within a SearchProvider")
8 }
9 return context
10 }