Skip to content

Commit

Permalink
fix: use hashchange event
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed Mar 1, 2022
1 parent c56e5ae commit 571119d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/use-hash-param.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export const link = (hashParam, value) => {
requestAnimationFrame(() => setParam(parameterized));
readParam();
window.addEventListener('popstate', readParam);
window.addEventListener('hash-changed', readParam);
window.addEventListener('hashchange', readParam);
return () => {
window.removeEventListener('popstate', readParam);
window.removeEventListener('hash-changed', readParam);
window.removeEventListener('hashchange', readParam);
};
}, [parameterized]);

Expand Down

0 comments on commit 571119d

Please sign in to comment.