Comments (4)
IMHO, the pattern 1 is far better. It could also be something like:
<EventListener
target={window}
onScroll={{
handler: this.handleScroll,
options: {
capture: false,
passive: true,
}
}
/>
from react-event-listener.
Implementation of withOptions
was thinking the following such simple things.
export function withOptions(handler, options) {
return { hanlder, options };
}
I think that your code may be simple !
from react-event-listener.
@tsuyoshiwada In that case, I don't see the harm in having a withOptions
helper π .
I'm not sure users will us it. But anyway.
from react-event-listener.
Thanks!
It is also likely to be easy to extend by cutting as a Function π
It sends a PR After implementing this!
from react-event-listener.
Related Issues (20)
- Getting `Can't resolve '@babel/runtime/helpers/builtin/classCallCheck'` after upgrading to Material UI 3.9.2
- An in-range update of mocha is breaking the build π¨
- Keypress doesn't work in Microsoft Edge HOT 3
- Error with Flow 54 HOT 4
- React 16.0 support. HOT 2
- Drop IE8 support
- Question: Which version should we use with React 15? (Specifically 15.6.x) HOT 1
- Module not found: Can't resolve '@babel/runtime/helpers/builtin/es6/getPrototypeOf' HOT 6
- IE10 - TypeError: "Cannot call a class as a function" HOT 1
- Use react-lifecycles-compat HOT 2
- Possibly unnecessary @babel/runtime? HOT 3
- γImportantγnot work with [email protected] HOT 5
- Fix @babel/runtime version on v5 HOT 7
- Try to listening mouse and keyboard event in ReactJS. HOT 1
- Update @babel/runtime to match material-ui project HOT 6
- Incorrect link in CHANGELOG HOT 1
- NPM distribution missing ES module build HOT 3
- Upgrade to @babel/runtime 7.1.2 HOT 7
- Rewrite using the Hook API HOT 2
- Any plans for passing SyntheticEvent instead of native event?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-event-listener.