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
Update useEvent implementation #19271
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit bd70f4f:
|
I'm confused. This looks less like the internal version than before. Edit Oh I see. There's a pending Diff that updates ReactUseEvent too. |
let setListener; | ||
let clears; | ||
let useEventHandle; | ||
const handleRef = useRef<UseEventHandle | null>(null); |
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.
Any reason we use generics for the event and target types internally, but not in this repo?
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.
We use Scopes internally, which means that the target needs be generic to cover them too. On the web, we can stick with EventTarget, so I could simplify it on githib. Good question though!
This updates the
useEvent
implementation within this repo to match that of our internal version, for consistency.