Fork me on GitHub
#om
<
2017-08-19
>
steveb8n00:08:00

has anyone seen this warning in om.next before? Warning: Unknown props meta`, cnt, arr, __hash, cljs$lang$protocol_mask$partition0$, cljs$lang$protocol_mask$partition1$ on <div> tag. Remove these props from the element.`

tony.kay02:08:15

@steveb8n Yes. It means the props you sent to a div tag are not know by the underlying React DOM function, and it is warning you incase you misspelled them.

tony.kay02:08:39

My guess is you forgot the #js?

tony.kay02:08:53

or call to clj->js if it’s a clojure persistent data structure in cljs

tony.kay02:08:21

since those sound like the internal impl props within a clj data structure

steveb8n02:08:27

@tony.kay I noticed that they are attributes in a cljs map

steveb8n02:08:46

so props passed to any component must be in js shape

tony.kay02:08:49

(dom/div #js { :className "a"} ...)

tony.kay02:08:05

or (dom/div (clj->js {:className "a"}))

tony.kay02:08:20

the latter is nice if you’re doing manipulation of a data structure in advance

steveb8n02:08:25

cool. I started with om server side rendering so clj maps worked ok there

tony.kay02:08:40

#js is identity on th eserver

steveb8n02:08:07

ah ok, I’ll try that. thanks

tony.kay02:08:19

I have SSR stuff in cljc, and I def clj->js to identity..then the code works in both

steveb8n02:08:38

me too 🙂

tony.kay02:08:46

If you look in the om source, it has a data readers file for defining #js I think on the clj side

steveb8n02:08:17

thanks again, now I know I’m looking in the right place

drcode15:08:50

@steveb8n Another option is to use plumatic om-tools https://github.com/plumatic/om-tools

drcode15:08:21

it automatically takes care of the js conversions

drcode15:08:38

I use it for all my om projects