:key is a keyword which is used to look up app state (as pointed to by the
cursor passed to build) and the value found there is then used as the react
key.
:react-key is a value (eg a string) which is used as the react key directly.
For example:
(om/build my-component {:foo "hello"} {:key :foo}) ; React key is now
"hello"
(om/build my-component data {:react-key "hello"}) ; React key is now also
"hello"
:key is really useful for rendering lists of components using build-all or
for generating semantic ids from the content being rendered (eg internal
ids).
On 24 September 2014 17:50, David James <[email protected]> wrote:
> Thanks David. I don't quite get the difference between :key and
> :react-key. Is there an example?
>
> > It's described in the documentation for the build function here:
> > https://github.com/swannodette/om/wiki/Documentation#build
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.