Files
react/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-function-expression-mutates-immutable-value.js
2024-04-02 16:49:31 -07:00

10 lines
271 B
JavaScript

function Component(props) {
const [x, setX] = useState({ value: "" });
const onChange = (e) => {
// INVALID! should use copy-on-write and pass the new value
x.value = e.target.value;
setX(x);
};
return <input value={x.value} onChange={onChange} />;
}