I have the following code...
const Thing = ({...})=> {
const initialState = {
foo: ''
}
const [state, setState] = useState(initialState);
const changeFormvalue = (e) => {
state.foo = e.target.value;
setState(state);
}
return (
<input type="text" name ="foo"
value={state.foo}
onChange={changeFormvalue} />
)
}
When I run I see it hit the function, and I see it set the value. However, after the setState command, the page does not rerender and the value is not updated.
Why is the page not updating?