mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-05 23:43:37 +02:00
refact: extract location to provider/hook
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { useContext } from "react"
|
||||
import { ILocationContextInterface, LocationContext } from "../LocationProvider"
|
||||
|
||||
export default function useLocation(): ILocationContextInterface {
|
||||
const locationContext = useContext(LocationContext)
|
||||
|
||||
if (!locationContext) {
|
||||
throw Error("Need context")
|
||||
}
|
||||
|
||||
return locationContext
|
||||
}
|
||||
Reference in New Issue
Block a user