Browse Source

[Beta] Remove `useEvent` link (#5035)

* [Beta] Remove `useEvent` link

* [Beta] Add `useEvent` stub page

* [Beta] Update `useEvent` description

* Update useEvent.md

* Alphabetical

Co-authored-by: dan <dan.abramov@gmail.com>
main
zqran 3 years ago
committed by GitHub
parent
commit
25171aa052
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      beta/src/content/apis/react/useEvent.md
  2. 2
      beta/src/content/learn/separating-events-from-effects.md
  3. 5
      beta/src/sidebarReference.json

22
beta/src/content/apis/react/useEvent.md

@ -0,0 +1,22 @@
---
title: useEvent
---
<Wip>
This section is incomplete, please see the RFC doc for [useEvent](https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md).
</Wip>
<Intro>
`useEvent` is a React Hook that lets you extract non-reactive Effect logic into an [Event function.](/learn/separating-events-from-effects#declaring-an-event-function)
```js
useEvent(callback)
```
</Intro>
<InlineToc />

2
beta/src/content/learn/separating-events-from-effects.md

@ -394,7 +394,7 @@ In other words, you *don't* want this line to be reactive, even though it is ins
// ...
showNotification('Connected!', theme);
// ...
````
```
You need a way to separate this non-reactive logic from the reactive Effect around it.

5
beta/src/sidebarReference.json

@ -113,6 +113,11 @@
"path": "/apis/react/useEffect",
"wip": true
},
{
"title": "useEvent",
"path": "/apis/react/useEvent",
"wip": true
},
{
"title": "useId",
"path": "/apis/react/useId",

Loading…
Cancel
Save