diff --git a/README.md b/README.md index 5007671..76e715a 100644 --- a/README.md +++ b/README.md @@ -833,13 +833,13 @@ import {actionAsync, task} from "mobx-utils" mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions class Store { - @observable githubProjects = [] - @state = "pending" // "pending" / "done" / "error" + @observable githubProjects = [] + @state = "pending" // "pending" / "done" / "error" - @actionAsync - async fetchProjects() { - this.githubProjects = [] - this.state = "pending" + @actionAsync + async fetchProjects() { + this.githubProjects = [] + this.state = "pending" try { // note the use of task when awaiting! const projects = await task(fetchGithubProjectsSomehow()) diff --git a/src/action-async.ts b/src/action-async.ts index 80f6bfa..466331a 100644 --- a/src/action-async.ts +++ b/src/action-async.ts @@ -112,13 +112,13 @@ export function actionAsync Promise>(fn: F): * mobx.configure({ enforceActions: "observed" }) // don't allow state modifications outside actions * * class Store { - * \@observable githubProjects = [] - * \@state = "pending" // "pending" / "done" / "error" + * \@observable githubProjects = [] + * \@state = "pending" // "pending" / "done" / "error" * - * \@actionAsync - * async fetchProjects() { - * this.githubProjects = [] - * this.state = "pending" + * \@actionAsync + * async fetchProjects() { + * this.githubProjects = [] + * this.state = "pending" * try { * // note the use of task when awaiting! * const projects = await task(fetchGithubProjectsSomehow())