feat(resources): open current path on page load

This commit is contained in:
Jean-Philippe Sirois
2019-11-08 19:22:33 -08:00
parent 3b3a68698f
commit 3f94a780be
3 changed files with 32 additions and 0 deletions
@@ -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()
}
}, [])
}