@@ -32,14 +32,14 @@ const model = observable({ count: 0 });
3232const add = ()=> model .count ++ ;
3333
3434const View1 = observer (() {
35- return < div> {model .count }< / div>
35+ return < div> {model .count }< / div> ;
3636});
3737
3838const View2 = observer (() {
3939 return < div>
4040 < span> {model .count }< / span>
4141 < button onClick= {add}> click< button>
42- < / div>
42+ < / div> ;
4343});
4444```
4545
@@ -53,7 +53,7 @@ const View = observer(() {
5353 return < div>
5454 < span> {model .count }< / span>
5555 < button onClick= {()=> model .count ++ }> click< button>
56- < / div>
56+ < / div> ;
5757});
5858```
5959
@@ -69,8 +69,10 @@ const user = observable({
6969
7070const View = observer (() {
7171 // The fullName will be cached and responsive
72- const fullName = useComputed (()=> ` ${ user .firstName } ${ user .lastName } ` );
73- return < div> {fullName}< / div>
72+ const fullName = useComputed (()=> {
73+ return ` ${ user .firstName } ${ user .lastName } ` ;
74+ });
75+ return < div> {fullName}< / div> ;
7476});
7577```
7678
@@ -88,7 +90,7 @@ const View = observer(() {
8890 useAutoRun (()=> {
8991 console .log (' count:' , model .count );
9092 });
91- return < div> {model .count }< / div>
93+ return < div> {model .count }< / div> ;
9294});
9395```
9496
@@ -105,7 +107,7 @@ const View = observer(() {
105107 useWatch (()=> model .count % 10 , (oldValue , newValue )=> {
106108 console .log (` old: ${ oldValue} , new: ${ newValue} ` );
107109 });
108- return < div> {model .count }< / div>
110+ return < div> {model .count }< / div> ;
109111});
110112```
111113
@@ -141,7 +143,7 @@ class View extends React.Component {
141143 return < div>
142144 < span> {this .message }< / span>
143145 < button onClick= {this .add }> click< button>
144- < / div>
146+ < / div> ;
145147 }
146148}
147149```
@@ -168,7 +170,7 @@ class View extends React.Component {
168170 return < div>
169171 < span> {this .model .message }< / span>
170172 < button onClick= {()=> this .model .add ()}> click< button>
171- < / div>
173+ < / div> ;
172174 }
173175}
174176```
0 commit comments