Created
October 25, 2019 20:00
-
-
Save sag1v/df4e8fd271c367c9569b771c5adc2deb to your computer and use it in GitHub Desktop.
Markdium-React state update on an unmounted component
This file contains hidden or 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
| 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