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
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
-
# nestedreact
2
-
This is React add-on designed to simplify migration to React views in large Backbone applications.
1
+
# NestedReact
2
+
This is React add-on providing advanced state management to React applications and convergence layer for intermixing React components and Backbone Views.
3
3
4
-
It allows you:
4
+
Brief feature list:
5
5
6
-
- To use React component in place of every Backbone View.
7
-
- To use your existing Backbone Views from React components.
8
-
- To use your existing Backbone Models as React component state.
9
-
- Update React components on Backbone events.
10
-
- Data-binding for models and collections
6
+
- Advanced component's state management with [NestedTypes](https://github.com/Volicon/backbone.nestedTypes).
7
+
- Comprehensive two-way data binding - [Guide to Data Binding Use Cases](/example/databinding.md)
8
+
- Transparent interoperation with Backbone Views:
9
+
- React component can be used as backbone View. `new MyComponent.View({ props })`
10
+
- Backbone Views can be used as React components. `<React.subview View={ MyView } />`
11
+
- Simplified refactoring of Backbone Views to React components. `this.$`, `this.$el`, `this.$( sel )`, `this.model` works for React components too, as well as `this.trigger` and `this.listenTo`.
11
12
12
-
Thus, no refactoring of your application is required. You can start writing UI with React immediately replacing your Backbone Views one-by-one, while keeping your existing models.
13
+
Thus, if you have Bakcbone application and want to start writing with React - you have no excuses any more. Wanna keep some of your cool Views? They works just fine? Keep 'em. And use them in yout new components, written with React, which you will use in other Backbone Views.
13
14
14
15
# Breaking changes introduced in 0.3
15
16
-`component.createView( props )` doesn't work any more, use `new component.View( props )` instead.
@@ -196,6 +197,9 @@ In addition to standard members `link.requestChange( x )` and `link.value`, link
196
197
197
198
Most efficient way to work with link is using `link.val()` function, that's how its internally implemented. `val` function is bound, and can be passed around safely.
198
199
200
+
Here's a brief reference for liks API. Consult [Guide to Data Binding Use Cases](/example/databinding.md) to understand how to use it.
201
+
202
+
199
203
### Link transformations
200
204
201
205
Attribute's link can be further transformed using extended link API. Link transformations allowing you to use new `stateless functions` component definition style introduced in React 0.14 in most cases.
@@ -232,5 +236,3 @@ attributes : {
232
236
```
233
237
234
238
Technically, "watcher" - is just a callback function with a single argument receiving new attribute value, so links are not required here.
235
-
236
-
[Guide to Data Binding Use Cases](/example/databinding.md)
Copy file name to clipboardExpand all lines: example/databinding.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,16 @@
2
2
3
3
Here are the set of examples for typical `nestedreact` data binding use cases.
4
4
5
+
Each section contains custom databound component, model definitions, and usage examples.
6
+
7
+
Somewhere at the top level component(s) there must be the declaration linking model updates to UI. Either models must be (nested) members of some component's state (which will update UI even in case of deep changes), or you may link component updates to changes of models and collections passed in props. In the last case, you will need to add following line to top or middle-level component definition:
8
+
9
+
```
10
+
listenToProps : 'myModel myCollection'
11
+
```
12
+
13
+
It's generally advised to keep stateful components at the top level, and use `listenToProps` in the middle level for optimization purposes if you want local updates. Keep you bottom-level components pure, and try to do the same for the most of your middle level (`listenToProps` used wisely won't hurt). For further information on this topic consult the top-level guide.
14
+
5
15
## Checkboxes
6
16
7
17
Standard `<input/>` will work. Custom Checkbox component might be implemented like this:
0 commit comments