Skip to content

Commit ebadb1d

Browse files
author
Vlad Balin
committed
Update readme.md
1 parent 98604f1 commit ebadb1d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/todomvc/readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ And it will work this way 90% of the time, [no matter, how complex your data are
5555
- [Used by](http://www.volicon.com/)
5656

5757
##FAQ
58+
### How can you do pure render with mutable models? I heard it's impossible.
59+
60+
By comparing object's versions. For _immutable_ data, reference to the data itself can be used as version token, it's the same thing. For _mutable_ data, you need to introduce separate version token, so we do it.
61+
62+
Every NestedTypes model and collection has `_changeToken` property, which contains empty object `{}` reassigned every time object is updated (and {} !== {}, they are separate objects allocated on heap). Inside of `shouldComponentUpdate`, we compare these version tokens for every model and collection listed in `props` with tokens used at last render. Thus, we're able to efficiently check whenever model or collection was changed since the last render.
63+
64+
It's works faster than any generic PureRenderMixin because we dynamically compile `shouldComponentUpdate` functions with _loops unrolled _, taking props list from component's `propTypes` (loops through hashes are very expensive, as well as `Object.keys` call).
65+
5866
### What does `editing : ToDo.from( '^props.todos' )` from `todolist.jsx` mean?
5967

6068
This is NestedTypes type annotation, which literally means "`editing` is the model of `ToDo` type which is taken from

0 commit comments

Comments
 (0)