title: Context not updating value when change routes
body: <p>So I have my context set like this:</p>
  <pre><code>import { createContext, ReactNode, useState } from &quot;react&quot;;
  
  type props = {
    children: ReactNode;
  };
  
  type GlobalContextType = {
    name: string;
    setName: (value: string) =&gt; void;
  };
  
  export const GlobalContext = createContext&lt;GlobalContextType&gt;(
    {} as GlobalContextType
  );
  
  export const GlobalProvider = ({ children }: props) =&gt; {
    const [name, setName] = useState&lt;string&gt;(&quot;&quot;);
  
    return (
      &lt;GlobalContext.Provider value={{ name, setName }}&gt;
        {children}
      &lt;/GlobalContext.Provider&gt;
    );
  };
  </code></pre>
  <p>And I also have a input</p>
  <pre><code>const { name, setName } = useContext(GlobalContext);
  
    const handleChange = (e: React.FormEvent&lt;HTMLInputElement&gt;): void =&gt; {
      setName(e.currentTarget.value);
    };
  
    &lt;input
        placeholder=&quot;Insert a username&quot;
        onChange={handleChange}
        data-testid=&quot;Login-input&quot;
    /&gt;
  </code></pre>
  <p>If I log the &quot;name&quot; value that is changed through the setName it seems to work just fine
  But I also have a login button that redirects to another route /home.</p>
  <pre><code>export const Home = () =&gt; {
    const { name } = useContext(GlobalContext);
    return (
      &lt;div&gt;
        &lt;p&gt;{name} &lt;/p&gt;
      &lt;/div&gt;
    );
  };
  </code></pre>
  <p>Here, the name displays as the default value that was set up in the context, not the updated one that I changed in the input.
  I tried to rewrite it but it doesn't seem to be wrong.
  Am I missing something?</p>