From 4a5373f4d92f518b227cdae0abd1baadaf12ae7e Mon Sep 17 00:00:00 2001 From: Konstantin Grigorchuk Date: Tue, 15 Oct 2024 22:11:40 +0300 Subject: [PATCH] docs: observable fields is not specified (#3930) --- docs/actions.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/actions.md b/docs/actions.md index d627f31a0..3b277a8ec 100644 --- a/docs/actions.md +++ b/docs/actions.md @@ -443,12 +443,19 @@ However, TypeScript isn't aware of that transformation, so `flowResult` will mak `flow`, like `action`, can be used to wrap functions directly. The above example could also have been written as follows: ```typescript -import { flow } from "mobx" +import { flow, makeObservable, observable } from "mobx" class Store { githubProjects = [] state = "pending" + constructor() { + makeObservable(this, { + githubProjects: observable, + state: observable, + }) + } + fetchProjects = flow(function* (this: Store) { this.githubProjects = [] this.state = "pending"