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

31 lines
701 B
JavaScript

import { fbt } from "fbt";
function Component() {
const buttonLabel = () => {
if (!someCondition) {
return <fbt desc="My label">{"Purchase as a gift"}</fbt>;
} else if (
!iconOnly &&
showPrice &&
item?.current_gift_offer?.price?.formatted != null
) {
return (
<fbt desc="Gift button's label">
{"Gift | "}
<fbt:param name="price">
{item?.current_gift_offer?.price?.formatted}
</fbt:param>
</fbt>
);
} else if (!iconOnly && !showPrice) {
return <fbt desc="Gift button's label">{"Gift"}</fbt>;
}
};
return (
<View>
<Button text={buttonLabel()} />
</View>
);
}