Tweak docs a little.

This commit is contained in:
Dan Holmsand 2014-02-21 16:24:04 +01:00
parent 5243b1bbf1
commit 0574a235ed
2 changed files with 16 additions and 5 deletions

View File

@ -144,6 +144,15 @@
[demo-component {:comp say-hello [demo-component {:comp say-hello
:src (src-for [:hello-component :say-hello])}] :src (src-for [:hello-component :say-hello])}]
[:p [:strong "Note: "]
"In the example above, " [:code "hello-component"] " might just
as well have been called as a normal Clojure function instead of
as a Reagent component, i.e with parenthesis instead of square
brackets. The only difference would have been performance, since
”real” Reagent components are only re-rendered when their data
have changed. More advanced components though (see below) must
be called with square brackets."]
[:p "Here is another example that shows items in a " [:p "Here is another example that shows items in a "
[:code "seq"] ":" ] [:code "seq"] ":" ]
@ -151,11 +160,11 @@
:src (src-for [:lister :lister-user])}] :src (src-for [:lister :lister-user])}]
[:p [:strong "Note: "] [:p [:strong "Note: "]
"The " [:code "^{:key item}"] " part isnt really necessary in "The " [:code "^{:key item}"] " part above isnt really necessary
this simple example, but attaching a unique key to every item in a in this simple example, but attaching a unique key to every item
dynamically generated list of components is good practice, and in a dynamically generated list of components is good practice,
helps React to improve performance for large lists. The key can and helps React to improve performance for large lists. The key
be given either (as in this example) as meta-data, or as a " can be given either (as in this example) as meta-data, or as a "
[:code ":key"] " item in the first argument to a component (if it [:code ":key"] " item in the first argument to a component (if it
is a map). See Reacts " [:a dynamic-children "documentation"] " is a map). See Reacts " [:a dynamic-children "documentation"] "
for more info."]])) for more info."]]))

View File

@ -91,6 +91,8 @@
[:ul [:ul
[:li "React has been updated to version 0.9.0."]
[:li "You can now use any object that satisfies " [:li "You can now use any object that satisfies "
[:code "ifn?"] " as a component function, and not just [:code "ifn?"] " as a component function, and not just
plain functions. That includes functions defined with " plain functions. That includes functions defined with "