I was reading this page: https://gist.github.com/lilactown/c0fd5d8df772412be79a034d627f8ff0
May I ask why this syntax ($ :mesh ... works?
Can I find some intro of this on https://cljdoc.org/d/lilactown/helix
why i don't need to refer the mesh component to the namespace?
thanks!
@lilactown do you mean use ($ "xxx" ...) instead of ($ :xxx ...)
no, either one is fine. But when you pass a string or a keyword to $, there is some special behavior that happens right now:
• it will convert kebab-case props like :on-click to camelcase onClick
• it will convert the :style prop value to a JS object
• it will rename special keys like :class to className and :for to :htmlFor
This behavior may be removed in the future, as it's not general for all renderers; e.g. threejs may want different handling for :style than React Native.
You can ignore this behavior by doing the pre-processing of :style yourself and ensuring keys passed to $ are already camelCase
got it! thanks!
yeah. FWIW I would recommend not relying on this behavior, it may change in a future version of helix. Instead, I would create a specific macro that wraps $ that converts the kebab-case props to camelCase and other stuff.
Strings and keywords are treated as "native elements"
Thanks! I found what you said in cljdoc: "OR it is a keyword e.g. :div"