From 2603e5e1a811da1b8a66b10c6897bc8ee10847e1 Mon Sep 17 00:00:00 2001 From: matushl Date: Sat, 9 Dec 2023 22:50:29 +0100 Subject: [PATCH] Fix non-changing title for competitions --- src/utils/PageTitleContainer.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/PageTitleContainer.tsx b/src/utils/PageTitleContainer.tsx index e20a2d42..b58d9ad7 100644 --- a/src/utils/PageTitleContainer.tsx +++ b/src/utils/PageTitleContainer.tsx @@ -1,8 +1,14 @@ import {useState} from 'react' import {createContainer} from 'unstated-next' +import {useUpdateEffect} from 'usehooks-ts' const usePageTitle = (initial = '') => { const [pageTitle, setPageTitle] = useState(initial) + + useUpdateEffect(() => { + setPageTitle(initial) + }, [initial]) + return {pageTitle, setPageTitle} }