Created
January 11, 2019 13:05
-
-
Save mfrachet/562e71aa814f25f9884ffdfda8176722 to your computer and use it in GitHub Desktop.
react-cache-propagate.js
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 secondIndirection = () => { | |
// bulbasaur is the pokemon with id=1 | |
const { name } = propagate pokemonById(1); | |
console.log(`Hello ${name}`); | |
}; | |
// Only aims to show that it's not only one level deep | |
const firstIndirection = () => secondIndirection(); | |
const main = () => { | |
withEffects { | |
firstIndirection(); | |
} handle pokemonById (id, resume) { | |
fetch(`${POKEMON_API}/${id}`).then(resume); | |
} | |
}; | |
// Prints "Hello bulbasaur" | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment