You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,12 +31,14 @@ A model or collection can only do requests to an API if you add an `api` instanc
31
31
32
32
A model is a data container with a set of helper functions. Models should extend `Model` from mobx-spine, and the very least define some properties.
33
33
34
-
### Constructor: data
35
-
36
34
The `Model` contructor takes 2 arguments:
37
35
-`data`: An object with default values for a model.
38
36
-`options`: An object with options.
39
37
38
+
### Constructor: data
39
+
40
+
Let's for example define a class `Animal` with 2 properties `id` and `name`.
41
+
40
42
```js
41
43
import { observable } from'mobx';
42
44
import { Model } from'mobx-spine';
@@ -48,7 +50,7 @@ class Animal extends Model {
48
50
}
49
51
```
50
52
51
-
We've defined a class `Animal` with 2 properties `id` and `name`. If we instantiate a new animal without arguments it will create an empty animal using defaults defined on the model:
53
+
If we instantiate a new animal without arguments it will create an empty animal using defaults defined on the model:
0 commit comments