DEV Community

Discussion on: All (or just most) of what you need to know about handling Promises

joetex profile image
Joel Ruiz • Edited on

You can chain the Promises. Inside of .then(), you can return another promise and it'll let you add another .then() underneath. You add a single .catch() at very end, which will work for all the .then() chains.

        console.log(data); // logs: longPromise resolved
        return shortPromise();
        console.log(data) // logs: shortPromise resolved
    .catch((error)=> {