I remember this picture
I don't know if there a promise hell example. Thanks for this great article.
Haha yeah this one's classic - good point too, you can hit "promise hell" too if you're not careful. Not as "pyramid" like as callback hell, but having ton's and tons of then's can get sort of annoying
then
Think also if it's also with If-Else Statements :)
Promise hell can't exist, that's why it's so nice!
const call_api = (url) => fetch(url).then(res => res.json()) const heaven = (url) => call_api(url).then(data => console.log(data)) heaven('/api/users') .then(() => heaven('/api/posts')) .then(([{ id }]) => heaven(`/api/posts/reactions?post=${id}`)) .then(({ post: id }) => heaven(`/api/comments?post=${id}`))
See? It's really clean 😃
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I remember this picture
I don't know if there a promise hell example. Thanks for this great article.
Haha yeah this one's classic - good point too, you can hit "promise hell" too if you're not careful. Not as "pyramid" like as callback hell, but having ton's and tons of
then
's can get sort of annoyingThink also if it's also with If-Else Statements :)
Promise hell can't exist, that's why it's so nice!
See? It's really clean 😃