helix

stagmoose 2023-11-12T15:28:32.988899Z

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!

stagmoose 2023-11-14T12:30:43.686569Z

@lilactown do you mean use ($ "xxx" ...) instead of ($ :xxx ...)

✅ 1
lilactown 2023-11-14T18:01:41.222399Z

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

👌 1
stagmoose 2023-11-15T01:24:59.851779Z

got it! thanks!

lilactown 2023-11-13T17:11:56.059849Z

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.

🙌 1
hifumi123 2023-11-12T20:53:04.632679Z

Strings and keywords are treated as "native elements"

stagmoose 2023-11-13T00:15:12.186319Z

Thanks! I found what you said in cljdoc: "OR it is a keyword e.g. :div"