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