title: Replace Method Not Working as Expected in React Component
body: <p>In my react component, I'm using the <code>replace</code> method to replace a word however this doesn't appear to be working:</p>
  <pre><code>const myComponent = () =&gt; {
  
     const [textVal, setTextVal] = useState(&quot;hello there&quot;)
  
     textVal.replace(&quot;hello&quot;, &quot;hi&quot;)
  
     console.log(textVal) // expecting &quot;hi there&quot; but still getting &quot;hello there&quot;
  
     return ( ... )
  
  }
  </code></pre>