My website is logging a user out after a period of inactivity for security reasons. Right now I have a pop up that shows up after a certain amount of time, but I'd like to modify the tab in some way to alert the user if they are in another tab. Ideally I'd like to change the tab color, but right now I'm just trying to change the tab title.
In pages/_app.tsx, I have
const TopComponent: NextPage<AppProps> = props => {
const { state } = useContext(AppContext);
const { sessionExpired } = state;
return (
<React.Fragment>
<Head>
<title>{sessionExpired ? 'true' : 'false'}</title>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
</Head>
...
<React.Fragment>
)
sessionExpired is a state variable from another file. It is false and changes to true after the timer runs out. I would expect the title to change from false to true, but it always remains false. Is there a way to change the title?