Files
react/compiler/crates/react_hermes_parser/tests/fixtures/nested-function-shadowed-identifiers.js
2024-04-02 16:49:31 -07:00

11 lines
283 B
JavaScript

function Component(props) {
const [x, setX] = useState(null);
const onChange = (e) => {
let x = null; // intentionally shadow the original x
setX((currentX) => currentX + x); // intentionally refer to shadowed x
};
return <input value={x} onChange={onChange} />;
}