onSubmit = () => {
return new Promise((resolve,reject) => {
try{
// try code here
console.log('I am in the promise function!');
resolve('resolved message');
}
catch(e){
reject(e);
}
});
//Use it...
onSubmit.then(() => {
console.log('I am in the first resolved promise');
}).then(() => {
console.log('I am in the second resolved promise');
});
}
Last active
July 11, 2018 17:04
-
-
Save andrit/bf290325b3011c8fba2c7e2a9b9441d7 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment