forked from marcusphillips/react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.beta
41 lines (29 loc) · 1.41 KB
/
README.beta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
additional documentation to be added
--- internals ---
each scope object contains two things - the scope and the parent
a lookup first checks the .scope object to see if the key is there
if it fails, it moves on to the .parent object (which is itself a scope object, containing a .scope property) and does the same thing
--------
ok, but how about something more interesting, like a whole chess game - how would you render that using this style? easy:
<body>
<div id="board" react="loop">
<div react="loop">
<div react="class piece, class color"></div>
</div>
</div>
<script>
var chessboard = someChessLibrary.makeBoard();
react.anchor($('#board'), chessboard).render();
</script>
</body>
That's it. After the call to render(), these 5 lines of template code will manage all the view updates for you. Whenver react gets notified of a change event on your js objects (and their contained objects), it will re-evaluate any relevant render directives.
---
other features
- react is designed to hide from you until it's useful
- this means it doesn't impose any design patterns on you other than it's declaration syntax
- doesn't clutter your objects with lots of methods, uses one string hash 'observers'
- not top level
- so you can mix and match with other tools, jquery plugins, widgets, etc
- use on just one widget
- correct auto-escaping
- a dom node is renderable and updatable