diff --git a/src/utils/useTitle.js b/src/utils/useTitle.js index af9b8b44..3ab032bc 100644 --- a/src/utils/useTitle.js +++ b/src/utils/useTitle.js @@ -30,7 +30,8 @@ export default function useTitle(title, path) { } useLayoutEffect(() => { + const unsub = subscribeKey(states, 'currentLocation', setTitle); setTitle(); - return subscribeKey(states, 'currentLocation', setTitle); + return unsub; }, [title, path]); }