Closed wcerfgba closed 3 years ago
This is a limitation of factory functions. Spread props only work with the $
macro, or macros which use the $
macro (e.g. the macros defined in helix.dom
).
Since factory functions are, as it says on the tin, functions, they can not do anything at compile time - which is what the $
macro does, rewrite the props at compile time to be akin to (merge {:bar "yo"} props)
.
The spread props behavior was created to optimize calls to React's createElement
function. Factory functions give up this optimization, for ease of typing 😄
Hope that makes sense. Doc improvement pull requests are most welcome!
Hello,
I've just noticed that if I define a component like
then I cannot pass through props like
instead I must
Is this a limitation of factory functions or just a bug? I can live without
:&
on factory functions if they are not possible, but maybe this should be documented atdocs/creating-elements.md#factory-functions
?Thank you! :smiley: