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

How to add child dynamically #4

Closed
eskimoblood opened this issue Jan 13, 2014 · 2 comments
Closed

How to add child dynamically #4

eskimoblood opened this issue Jan 13, 2014 · 2 comments

Comments

@eskimoblood
Copy link

In React I can add children like this:

<ol>
  {this.results.map(function(result) {
    return <li key={result.id}>{result.text}</li>;
  })}
</ol>

How would the equivalent look like with Cloak.

@holmsand
Copy link
Contributor

Any ClojureScript seq will be expanded in place, just like arrays in JavaScript React. Your example would look something like this:

[:ol
(for [result results]
[:li {:key (:id result)} (:text result)])]

(assuming results contains clojure maps).

See the third example on http://holmsand.github.io/cloact/

@eskimoblood
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants