JSFiddle - React, Tailwind, and code Playground

by rigor789

JavaScript

let test = () => new Promise((resolve, reject) => {
	resolve({foo: 'bar'})
})


let someAction = () => {

	return test().then((res) => {
  	// do something with the result
    console.log(res)
    
    // pass it to the next "then" in the chain
    return res;
  })
}


someAction().then((res) => {
	console.log('resolves!', res)
})