mirror of
https://github.com/facebook/react.git
synced 2026-02-26 04:04:59 +00:00
10 lines
271 B
JavaScript
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} />;
|
|
}
|