From 0574a235edaff37941ffe91810b325625cc43ab9 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Fri, 21 Feb 2014 16:24:04 +0100 Subject: [PATCH] Tweak docs a little. --- demo/reagentdemo/intro.cljs | 19 ++++++++++++++----- demo/reagentdemo/news/anyargs.cljs | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/demo/reagentdemo/intro.cljs b/demo/reagentdemo/intro.cljs index abb96ce..aa19561 100644 --- a/demo/reagentdemo/intro.cljs +++ b/demo/reagentdemo/intro.cljs @@ -144,6 +144,15 @@ [demo-component {:comp 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 " [:code "seq"] ":" ] @@ -151,11 +160,11 @@ :src (src-for [:lister :lister-user])}] [:p [:strong "Note: "] - "The " [:code "^{:key item}"] " part isn’t really necessary in - this simple example, but attaching a unique key to every item in a - dynamically generated list of components is good practice, and - helps React to improve performance for large lists. The key can - be given either (as in this example) as meta-data, or as a " + "The " [:code "^{:key item}"] " part above isn’t really necessary + in this simple example, but attaching a unique key to every item + in a dynamically generated list of components is good practice, + and helps React to improve performance for large lists. The key + 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 is a map). See React’s " [:a dynamic-children "documentation"] " for more info."]])) diff --git a/demo/reagentdemo/news/anyargs.cljs b/demo/reagentdemo/news/anyargs.cljs index f6a26d7..5d395ef 100644 --- a/demo/reagentdemo/news/anyargs.cljs +++ b/demo/reagentdemo/news/anyargs.cljs @@ -91,6 +91,8 @@ [:ul + [:li "React has been updated to version 0.9.0."] + [:li "You can now use any object that satisfies " [:code "ifn?"] " as a component function, and not just plain functions. That includes functions defined with "