mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-05 23:43:37 +02:00
feat(resources): open current path on page load
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
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()
|
||||
}
|
||||
}, [])
|
||||
}
|
||||
Reference in New Issue
Block a user