Skip to content

Instantly share code, notes, and snippets.

@mfrachet
Created January 11, 2019 13:05
Show Gist options
  • Save mfrachet/562e71aa814f25f9884ffdfda8176722 to your computer and use it in GitHub Desktop.
Save mfrachet/562e71aa814f25f9884ffdfda8176722 to your computer and use it in GitHub Desktop.
react-cache-propagate.js
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