Skip to content

Instantly share code, notes, and snippets.

@jcarroll2007
Last active February 4, 2022 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcarroll2007/c500a3dff1b7b3369342504558a31897 to your computer and use it in GitHub Desktop.
Save jcarroll2007/c500a3dff1b7b3369342504558a31897 to your computer and use it in GitHub Desktop.
JavaScript Bug Example
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