Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :key-fn documentation #859

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/om/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,9 @@

:key - a keyword that should be used to look up the key used by
React itself when rendering sequential things.
:key-fn - a function that should be used to look up the key used by
React itself when rendering sequential things.

:react-key - an explicit react key
:fn - a function to apply to the data before invoking f.
:init-state - a map of initial state to pass to the component.
Expand Down Expand Up @@ -1023,7 +1026,9 @@
(defn build-all
"Build a sequence of components. f is the component constructor
function, xs a sequence of values, and m a map of options the
same as provided to om.core/build."
same as provided to om.core/build.
To avoid warnings from React, please provide either :key or :key-fn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please

Seems too polite for a docstring 😛.

in the options map"
([f xs] (build-all f xs nil))
([f xs m]
{:pre [(ifn? f) (or (nil? m) (map? m))]}
Expand Down