Aug 23, 2017 · 1 min read
Your original example is slightly contrived, because you are wrapping a promise in a promise:
const promiseFunc = () => new Promise((resolve) => {
fetchSomething().then(result => {
resolve(result + ' 2');
});
});This could be simplified to:
const promiseFunc = () => {
return fetchSomething().then(result => result + ' 2');
};This also has the advantage that if `fetchSomething` fails, errors will propagate to outer promises.