mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 23:44:11 +02:00
13 lines
293 B
TypeScript
13 lines
293 B
TypeScript
import { useEffect } from "react"
|
|
import useLocation from "../../hooks/useLocation"
|
|
|
|
export default function useMatchingPath(path: string, callback: () => void) {
|
|
const { isMatchingPath } = useLocation()
|
|
|
|
useEffect(() => {
|
|
if (isMatchingPath(path)) {
|
|
callback()
|
|
}
|
|
}, [])
|
|
}
|