Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solid/reactivity rule for props.onWhatever #48

Closed
baptisteArno opened this issue Dec 15, 2022 · 1 comment · Fixed by #49
Closed

solid/reactivity rule for props.onWhatever #48

baptisteArno opened this issue Dec 15, 2022 · 1 comment · Fixed by #49
Assignees
Labels
question Further information is requested

Comments

@baptisteArno
Copy link

Not sure to understand the solid/reactivity rule on this line:

<TextBubble onTransitionEnd={props.onTransitionEnd} />

Why is it preferable to write

<TextBubble onTransitionEnd={() => props.onTransitionEnd()} />

?

We discussed this here: https://discord.com/channels/722131463138705510/722131463889223772/1052165321663975467

@baptisteArno baptisteArno added the question Further information is requested label Dec 15, 2022
@joshwilsonvu
Copy link
Collaborator

From the discussion and some testing, it looks like you're right—for Components, it works to write onTransitionEnd={props.onTransitionEnd} without the extra wrapper function. For native elements, the wrapper is still needed, because event handlers on native elements aren't reactive and an update to the prop doesn't get reattached as a new event listener. I'm planning to make a quick change to make the warnings reflect that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
2 participants