From a0f16057a01064fa79c3800c05786aa21e116b7b Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 10 Sep 2023 15:29:52 +0800 Subject: [PATCH] Make this more readable --- src/utils/useTitle.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]); }