Files
react/compiler/crates/react_hermes_parser/tests/fixtures/error.invalid-freeze-conditionally-mutable-lambda.js
2024-04-02 16:49:31 -07:00

17 lines
228 B
JavaScript

function Component(props) {
const x = {};
let fn;
if (props.cond) {
// mutable
fn = () => {
x.value = props.value;
};
} else {
// immutable
fn = () => {
x.value;
};
}
return fn;
}