Skip to content

Instantly share code, notes, and snippets.

@ShopifyEng
Created Jul 22, 2022
Embed
What would you like to do?
Mastering React's Stable Values - inline-jsx.tsx
function Overview() {
const [showMore, toggleShowMore] = useReducer(false, state => !state);
let details: JSX.Element
if (showMore) {
details = (<>
<Details />
<Button onPress={toggleShowMore}>Hide Details</Button>
</>);
}
else {
details = <Button onPress={toggleShowMore}>Show Details</Button>;
}
return ... {details} ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment