-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[ClickAwayListener] Hide react-event-listener #15420
[ClickAwayListener] Hide react-event-listener #15420
Conversation
During the refactor to hooks I'm removing EventListener where I can in favour of hooks |
Details of bundle changes.Comparing: f132c3c...e510c1e
|
d3313d7
to
e510c1e
Compare
@@ -114,6 +114,11 @@ ClickAwayListener.propTypes = { | |||
touchEvent: PropTypes.oneOf(['onTouchStart', 'onTouchEnd', false]), | |||
}; | |||
|
|||
if (process.env.NODE_ENV !== 'production') { | |||
// eslint-disable-next-line | |||
ClickAwayListener['propTypes' + ''] = exactProp(ClickAwayListener.propTypes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess this tricks babel-plugin-remove-prop-types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are correct. While I didn't try without it in this specific case.
Closes #15126
The new react hooks API makes the usage of react-event-listener less interesting. I think that it would be great to remove this dependency. It might yield a small bundle size gain (0.7 KB gzipped): https://bundlephobia.com/[email protected].