Skip to content

Commit 4a5373f

Browse files
authored
docs: observable fields is not specified (#3930)
1 parent f91d2e1 commit 4a5373f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/actions.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,19 @@ However, TypeScript isn't aware of that transformation, so `flowResult` will mak
443443
`flow`, like `action`, can be used to wrap functions directly. The above example could also have been written as follows:
444444

445445
```typescript
446-
import { flow } from "mobx"
446+
import { flow, makeObservable, observable } from "mobx"
447447

448448
class Store {
449449
githubProjects = []
450450
state = "pending"
451451

452+
constructor() {
453+
makeObservable(this, {
454+
githubProjects: observable,
455+
state: observable,
456+
})
457+
}
458+
452459
fetchProjects = flow(function* (this: Store) {
453460
this.githubProjects = []
454461
this.state = "pending"

0 commit comments

Comments
 (0)