Is there a way to pass a prop called with the prefix on without it being registered as an event handler?
I might been doing it wrong all this time but I normally pass functions as props and call them onSomethingHappened.
On components and functional components props starting with on are passed as normal props.
No need to change anything.
Here an example showing preacts behavior.
Thanks @Kanaye! That example was just what I needed.
I guess I don't understand this part of the code then https://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/dom/index.js#L65 not sure when this is running.
setAccessor is called by diffAttributes https://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/vdom/diff.js#L307 which is called by idiff https://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/vdom/diff.js#L148.
But in case of components idiff returns early https://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/vdom/diff.js#L100 bevor any dom diffing code is executed.
So setAccessor is only executed for vdom nodes that represent a real dom node and not for components.
鉂わ笍 It finally makes sense (to me)! Thank you so much @Kanaye
Most helpful comment
setAccessoris called bydiffAttributeshttps://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/vdom/diff.js#L307 which is called byidiffhttps://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/vdom/diff.js#L148.But in case of components
idiffreturns early https://github.com/developit/preact/blob/66d74c5d210ee72e41732e6aa5efb0e23d0c09ba/src/vdom/diff.js#L100 bevor any dom diffing code is executed.So setAccessor is only executed for vdom nodes that represent a real dom node and not for components.