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

Update useEvent implementation #19271

Merged
merged 1 commit into from Jul 7, 2020
Merged

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Jul 7, 2020

This updates the useEvent implementation within this repo to match that of our internal version, for consistency.

@trueadm trueadm requested a review from bvaughn July 7, 2020 12:32
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Jul 7, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 7, 2020

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:

Sandbox Source
React Configuration

@sizebot
Copy link

sizebot commented Jul 7, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against bd70f4f

@sizebot
Copy link

sizebot commented Jul 7, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against bd70f4f

@bvaughn
Copy link
Contributor

bvaughn commented Jul 7, 2020

This updates the useEvent implementation within this repo to match that of our internal version, for consistency.

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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!

@trueadm trueadm merged commit 98390f1 into facebook:master Jul 7, 2020
@trueadm trueadm deleted the update-use-event branch July 7, 2020 13:45
trueadm added a commit to trueadm/react that referenced this pull request Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants