Created
May 26, 2020 20:06
-
-
Save tudorilisoi/b10d20cf5fe8b6788188c2f247b8c2de to your computer and use it in GitHub Desktop.
This file contains 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
fetch('/api/recipe').then(res => { | |
const data = res.json() | |
//do smthng with react | |
return data | |
}) | |
.then(parsedJSON => { | |
fetch(`/api/recipes/${data.id}`) | |
}) | |
.catch(e => { | |
}) | |
const p = Promise.resolve(42) | |
// p.then(actualValue=>{}) | |
async function chain2P() { | |
try { | |
x = 32 | |
const res = await fetch('/api/recipe') | |
const parsedData = res.json() | |
const extData = await fetch(`/api/recipes/${parsedData.id}`) | |
const parsedExtData = res.json() | |
} catch (error) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment