Promise chaining

Promise chaining sequences asynchronous steps with then: each then returns a new promise whose value is the one returned by its function. Returning a promise inside a then makes the next step wait. You must return the value or the promise, otherwise the chain loses the result.

Example

fetch('/api/user')
  .then(r => r.json())
  .then(u => console.log(u.nom))

Related concepts

The whole glossary