Files
react/compiler/crates/react_hermes_parser/tests/fixtures/conditional-on-mutable.js
2024-04-02 16:49:31 -07:00

27 lines
403 B
JavaScript

function ComponentA(props) {
const a = [];
const b = [];
if (b) {
a.push(props.p0);
}
if (props.p1) {
b.push(props.p2);
}
return <Foo a={a} b={b} />;
}
function ComponentB(props) {
const a = [];
const b = [];
if (mayMutate(b)) {
a.push(props.p0);
}
if (props.p1) {
b.push(props.p2);
}
return <Foo a={a} b={b} />;
}
function Foo() {}
function mayMutate() {}