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

54 lines
818 B
JavaScript

/**
* props.b does *not* influence `a`
*/
function ComponentA(props) {
const a_DEBUG = [];
a_DEBUG.push(props.a);
if (props.b) {
return null;
}
a_DEBUG.push(props.d);
return a_DEBUG;
}
/**
* props.b *does* influence `a`
*/
function ComponentB(props) {
const a = [];
a.push(props.a);
if (props.b) {
a.push(props.c);
}
a.push(props.d);
return a;
}
/**
* props.b *does* influence `a`, but only in a way that is never observable
*/
function ComponentC(props) {
const a = [];
a.push(props.a);
if (props.b) {
a.push(props.c);
return null;
}
a.push(props.d);
return a;
}
/**
* props.b *does* influence `a`
*/
function ComponentD(props) {
const a = [];
a.push(props.a);
if (props.b) {
a.push(props.c);
return a;
}
a.push(props.d);
return a;
}