diff --git a/docs/refguide/api.md b/docs/refguide/api.md index 324f83167..2eff8254b 100644 --- a/docs/refguide/api.md +++ b/docs/refguide/api.md @@ -173,6 +173,25 @@ decorate(TodoList, { }) ``` +For applying multiple decorators on a single property, you can pass an array of decorators. The decorators application order is from right to left. +```javascript +import { decorate, observable } from 'mobx' +import { serializable, primitive } from 'serializr' +import persist from 'mobx-persist' + +class Todo { + id = Math.random(); + title = ''; + finished = false; +} + +decorate(Todo, { + title: [serializable(primitive), persist('object'), observable], + finished: [serializable(primitive), observable] +}) +``` +Note: Not all decorators can be composed together, and this functionality is just best-effort. Some decorators affect the instance directly and can 'hide' the effect of other decorators that only change the prototype. + ## Computed values