fix: update effect on callback change

This commit is contained in:
EnixCoda 2021-01-13 00:39:56 +08:00
parent e23ccd9124
commit 35f6084054
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -6,5 +6,5 @@ export function useOnLocationChange(
extraDeps: React.DependencyList = [],
) {
const { href, pathname, search } = useLocation()
React.useEffect(callback, [href, pathname, search, ...extraDeps])
React.useEffect(callback, [href, pathname, search, callback, ...extraDeps])
}