Replies: 2 comments
-
Yeah I need to document this. This is a tricky one. Because I can't tell if it is a handler or a signal when you pass a thunk. As any thunk can be reactive. This is a core part of the design not to have a JSX doesn't have this shortcoming because you write it as if you pass values. A function passed to a binding is always considered not requiring a reactive wrapper so passing functions never has this problem. But since HyperScript and Lit versions don't have the ability to analyze the shape of the input we can't do that. I had 2 choices here. One is to make the The other option which I implemented was if the function has an argument I knew it couldn't be a signal. So changing it to I'm open to thoughts. Both of these options are pretty awkward. Technically I could apply both safely as long as people didn't pass things that started with |
Beta Was this translation helpful? Give feedback.
-
Yeah, that's what I guessed, thanks for confirming. I end up passing using this style: |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Passing props issues when using
lit-domexpression
To Reproduce
Provide a code snippet and steps to reproduce the behavior:
<H3 />
's onclick handler got called unexpectedly without any interaction. I have to wrap one more level to make it works:() => () => console.log("click h3")
Expected behavior
I should be able to pass onClick handler to custom component and it should only get called when I actually click the component
Beta Was this translation helpful? Give feedback.
All reactions