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

Update README.md #196

Closed
wants to merge 1 commit into from
Closed

Conversation

aliaksandr-s
Copy link

Trying to use these examples from the readme:

(require [rum.core :as rum])

(rum/defc repeat-label [n text]
  [:div (repeat n [:.label text])])

(rum/mount (repeat-label 5 "abc") js/document.body)

Giving the next error:

#object[Error Invariant Violation: Objects are not valid as a React child (found: obj
ect with keys {meta, count, val, next, __hash, cljs$lang$protocol_mask$partition0$, c
ljs$lang$protocol_mask$partition1$}). If you meant to render a collection of children
, use an array instead.

So I suppose the examples should be updated a bit.

@tonsky
Copy link
Owner

tonsky commented Mar 9, 2020

I’m pretty sure vec wouldn’t work #195 (comment)

About repeat, I have an idea why it might not work either. It doesn’t produce “normal” sequence, but some special object that implements some protocols but not the ones that sablono checks when identifying the issue.

I even have a feeling I’ve hit it already, repeat -> add vec -> remove vec, but then forgot about it and am back at repeat. I’ll look into it, thanks!

@tonsky
Copy link
Owner

tonsky commented Mar 9, 2020

Found it #166 r0man/sablono#201

@aliaksandr-s
Copy link
Author

I haven't tried to use vec with rum/render-html but it does work with rum/mount

tonsky added a commit that referenced this pull request Mar 9, 2020
@tonsky
Copy link
Owner

tonsky commented Mar 9, 2020

Ok, workaround for now is to use replicate instead of repeat, which is a normal lazy sequence

@tonsky tonsky closed this Mar 9, 2020
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

Successfully merging this pull request may close these issues.

2 participants