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

Allow forwarding event handlers without wrapper function in Components #49

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

joshwilsonvu
Copy link
Collaborator

Closes #48. solid/reactivity has a warning in place to let people know about the following:

Events are never rebound and the bindings are not reactive, as it is expensive to attach and detach listeners. Since event handlers are called like any other function each time an event fires, there is no need for reactivity; shortcut your handler if desired.

However, a demo revealed that this doesn't apply to components, and passing a function-valued prop as an expression (ex. <Comp onClick={props.onClick}) works normally. I adjusted the rule to treat event handlers on components the same as other props.

@joshwilsonvu joshwilsonvu self-assigned this Dec 18, 2022
@baptisteArno
Copy link

Any update on this? 😀

@joshwilsonvu joshwilsonvu merged commit f5efaff into main Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

solid/reactivity rule for props.onWhatever
2 participants