Skip to content

Commit a50252f

Browse files
committed
Guides: Getting Started => Shared bindable data => switch vms to state providers #6371
1 parent 9e66690 commit a50252f

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

resources/data/deck/learnneo/pages/gettingstarted/ComponentModels.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Neo has a feature that allows shared, bindable, data.
22

3-
A _view model_ — `Neo.model.Component` — instance holds properties that
3+
A _state provider_ — `Neo.state.Provider` — instance holds properties that
44
can be bound to component properties.
55

66
<pre data-neo>
@@ -12,7 +12,7 @@ class MainView extends Container {
1212
static config = {
1313
className: 'GS.data1.MainView',
1414

15-
model: {
15+
stateProvider: {
1616
data: {
1717
foo: 'Hi there!'
1818
}
@@ -83,7 +83,7 @@ class MainView extends Container {
8383
static config = {
8484
className: 'GS.data2.MainView',
8585

86-
model: {
86+
stateProvider: {
8787
data: {
8888
foo: 'parent'
8989
}
@@ -95,8 +95,9 @@ class MainView extends Container {
9595
module: MyPanel
9696
}, {
9797
module: MyPanel,
98-
// You wouldn't normally configure a view model. We're doing it here to illustrate view model scope.
99-
model: {
98+
// You wouldn't normally configure a state provider.
99+
// We're doing it here to illustrate state provider scope.
100+
stateProvider: {
100101
data: {
101102
foo: 'child'
102103
}
@@ -109,7 +110,7 @@ MainView = Neo.setupClass(MainView);
109110
</pre>
110111

111112
In this case, the main view has three child items of type `MyPanel`, each containing a label.
112-
The main view has a view model with a `foo` property, and the third child has its own view model with a `foo` property.
113+
The main view has a state provider with a `foo` property, and the third child has its own state provider with a `foo` property.
113114

114115
<img width="75%" src="https://s3.amazonaws.com/mjs.neo.learning.images/gettingStarted/vm/VisualHierarchyFooShadowed.png"></img>
115116

@@ -124,5 +125,5 @@ because the third copy of `MyPanel` has its own view model with the `foo` proper
124125

125126
## Conclusion
126127

127-
The Neo.mjs view model and binding approach is simple and powerful. It gives you easy control
128+
The Neo.mjs state provider and binding approach is simple and powerful. It gives you easy control
128129
over the scope of a value, which means you can share properties as globally or narrowly as needed.

0 commit comments

Comments
 (0)