Skip to content

async/await and runInAction #2645

Discussion options

You must be logged in to vote

code works for me
also it works in this

try {
            const result = await api.asyncMethod();
            this.state = result;
            const newResult = await someAsyncMethod();
            this.anotherState = newResult;
        }
        catch (e) {
            someCatchMethod(e);
        }
       finally {
            runInAction(() => {
                  this.state= "end";
            });
        }

in some cases like this

try {
            const result = await api.asyncMethod();
            this.state = result;
            const newResult = await someAsyncMethod();
        }
        catch (e) {
            someCatchMethod(e);
        }
       finally {
            this.state= …

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@mweststrate
Comment options

@MariiaIasakova
Comment options

@da1z
Comment options

@jheeffer
Comment options

Answer selected by danielkcz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants