I have a functional Component that has the following code.
import { isUserAuthCheck } from "../../Utils/SessionStorage"; function DefaultPage({ history }) { useEffect(() => void (isUserAuthCheck ? history.push("/home") : null)); and in my Utils/SessionStorage, I have the following
export const isUserAuthCheck = sessionStorage.getItem("isUserAuthenticated") === "true"; export const getIsUserAuthenticated = sessionStorage.getItem( "isUserAuthenticated" ); export const setValueInSession = (key, value) => sessionStorage.setItem(key, value); export const setIsUserAuthenticated = str => sessionStorage.setItem("isUserAuthenticated", str); Problem here is, isUserAuthCheck doesn't seem to update every time there's a change in sessionStorage. How can I make sure that it's getting updated every time there's a change in sessionStorage.
Any help is appreciated.
