|
139 | 139 |
|
140 | 140 | [:p "You can build new components using other components as |
141 | 141 | building blocks. Like this:"] |
142 | | - [demo-component {:comp simple-parent |
| 142 | + [demo-component {:expected simple-parent |
| 143 | + :comp solutions/simple-parent |
143 | 144 | :src (s/src-of [:simple-parent])}] |
144 | 145 |
|
145 | 146 | [:p "Data is passed to child components using plain old Clojure |
146 | 147 | data types. Like this:"] |
147 | 148 |
|
148 | | - [demo-component {:comp say-hello |
| 149 | + [demo-component {:expected say-hello |
| 150 | + :comp solutions/say-hello |
149 | 151 | :src (s/src-of [:hello-component :say-hello])}] |
150 | 152 |
|
151 | 153 | [:p [:strong "Note: "] |
|
160 | 162 | [:p "Here is another example that shows items in a " |
161 | 163 | [:code "seq"] ":" ] |
162 | 164 |
|
163 | | - [demo-component {:comp lister-user |
| 165 | + [demo-component {:expected lister-user |
| 166 | + :comp solutions/lister-user |
164 | 167 | :src (s/src-of [:lister :lister-user])}] |
165 | 168 |
|
166 | 169 | [:p [:strong "Note: "] |
|
184 | 187 | re-rendered when its value changes."] |
185 | 188 |
|
186 | 189 | [:p "Let’s demonstrate that with a simple example:"] |
187 | | - [demo-component {:comp counting-component |
| 190 | + [demo-component {:expected counting-component |
| 191 | + :comp solutions/counting-component |
188 | 192 | :src [:pre |
189 | 193 | ns-src |
190 | 194 | (s/src-of [:click-count :counting-component])]}] |
|
196 | 200 | [:code "setTimeout"] " every time the component is rendered to |
197 | 201 | update a counter:"] |
198 | 202 |
|
199 | | - [demo-component {:comp timer-component |
| 203 | + [demo-component {:expected timer-component |
| 204 | + :comp solutions/timer-component |
200 | 205 | :src (s/src-of [:timer-component])}] |
201 | 206 |
|
202 | 207 | [:p "The previous example also uses another feature of Reagent: a |
|
210 | 215 | [:p "By simply passing an "[:code "atom"]" around you can share |
211 | 216 | state management between components, like this:"] |
212 | 217 |
|
213 | | - [demo-component {:comp shared-state |
| 218 | + [demo-component {:expected shared-state |
| 219 | + :comp solutions/shared-state |
214 | 220 | :src [:pre |
215 | 221 | ns-src |
216 | 222 | (s/src-of [:atom-input :shared-state])]}] |
|
292 | 298 | [:p "Data is kept in a single " [:code "reagent.core/atom"] ": a map |
293 | 299 | with height, weight and BMI as keys."] |
294 | 300 |
|
295 | | - [demo-component {:comp bmi-component |
| 301 | + [demo-component {:expected bmi-component |
| 302 | + :comp solutions/bmi-component |
296 | 303 | :src [:pre |
297 | 304 | ns-src |
298 | 305 | (s/src-of [:bmi-data :calc-bmi :slider |
|
306 | 313 | Leiningen project files and everything. Here’s one of them in |
307 | 314 | action:"] |
308 | 315 |
|
309 | | - [demo-component {:comp simple/simple-example |
| 316 | + [demo-component {:expected simple/simple-example |
310 | 317 | :complete true |
311 | 318 | :src (s/src-of nil "simpleexample/core.cljs")}]]) |
312 | 319 |
|
|
318 | 325 | Reagent (cheating a little bit by skipping routing and |
319 | 326 | persistence):"] |
320 | 327 |
|
321 | | - [demo-component {:comp todo/todo-app |
| 328 | + [demo-component {:expected todo/todo-app |
322 | 329 | :complete true |
323 | 330 | :src (s/src-of nil "todomvc/core.cljs")}]]) |
324 | 331 |
|
|
0 commit comments