Last active
February 4, 2022 14:37
-
-
Save jcarroll2007/c500a3dff1b7b3369342504558a31897 to your computer and use it in GitHub Desktop.
JavaScript Bug Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterAnimals(animals) { | |
if (!FeatureFlag.releaseTheLions) { | |
return animals.filter(maybeLeo => maybeLeo.id !== 'lion'); | |
} | |
} | |
const AnimalsList: React.VFC = () => { | |
const animals = [ | |
{ | |
name: 'Leo', | |
key: 'lion', | |
}, | |
{ | |
name: 'Panda', | |
key: 'panda', | |
}, | |
]; | |
return ( | |
<ul> | |
{filterAnimals(animals).map(({ name, key }) => ( | |
<li key={key}>{name}</li> | |
))} | |
</ul> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment