Files
2026-08-27 21:09:14 +00:00

12 lines
263 B
JavaScript

function Component(props) {
const ref = useRef(null);
const onChange = e => {
const newValue = e.target.value ?? ref.current;
ref.current = newValue;
};
useEffect(() => {
console.log(ref.current);
});
return <Foo onChange={onChange} />;
}