Component's "on" property should be a function Error #3610
Replies: 2 comments
-
I don't think there is enough information for us to understand what you're trying to achieve. Can you share the section of the code that lead to this error? Like the AMP component and which props you're passing to it? The linked excerpt from Preact's source checks if we're dealing with a DOM element, for which props starting with The |
Beta Was this translation helpful? Give feedback.
-
Thank you for pointing out my fault and sorry for lacking of enough explanations.
That's it. |
Beta Was this translation helpful? Give feedback.
-
I always get an error like 'Component's "on" property should be a function Error' typically with AMP development.
Although this can be solved with
dangerouslySetInnerHTML
feature, it's annoying with some complicated implementations.I found the condition
!('$$typeof' in vnode) // allow string refs when preact-compat is installed
is not applied to the props starts withon
in the source code and made a version including it to find it works fine.Can I ask why these conditions are different from each other?
https://github.com/preactjs/preact/blob/master/debug/src/debug.js#L183-L213
Beta Was this translation helpful? Give feedback.
All reactions