[core] Remove unnecessary usages of useEventCallback
#28910
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's best to review this PR without whitespace changes.
I've removed references to
useEventCallback
where as far as I can tell, there would be no difference from the way it's currently used:useButton
, it was applied to functions that would create event handlers, but then these "factory" functions are called inside this file, so there's no need to maintain a stable reference to them. I've also added acreate
prefix to them to match the naming convention used in https://github.com/mui-org/material-ui/blob/e0cdcd130db60d252c4382570844ea7278649a08/packages/mui-material/src/ClickAwayListener/ClickAwayListener.tsx#L149 for clarity.useSwitch
again the functions were not passed outside of the hook and only called inside this file, so there's no point in maintaining a stable referenceSliderUnstyled
the event handlers that I've removed it from, were passed directly to<input>
and React doesn't require them to have a stable reference: https://twitter.com/dan_abramov/status/1102708434821173249