Skip to content

Instantly share code, notes, and snippets.

@sag1v
Created October 25, 2019 20:23
Show Gist options
  • Save sag1v/a108480fe296bea7a6b2624cfdc3f7a1 to your computer and use it in GitHub Desktop.
Save sag1v/a108480fe296bea7a6b2624cfdc3f7a1 to your computer and use it in GitHub Desktop.
Markdium-React race condition bug
const petsDB = {
dogs: { name: "Dogs", voice: "Woof!", avatar: "🐶" },
cats: { name: "Cats", voice: "Miauuu", avatar: "🐱" }
};
export function getPet(type) {
return new Promise(resolve => {
// simulate a fetch call
setTimeout(() => {
resolve(petsDB[type]);
}, 1000);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment