In my react component, I'm using the replace
method to replace a word however this doesn't appear to be working:
const myComponent = () => {
const [textVal, setTextVal] = useState("hello there")
textVal.replace("hello", "hi")
console.log(textVal) // expecting "hi there" but still getting "hello there"
return ( ... )
}