From 25171aa05208b1ef51f1199348be364081cdfb32 Mon Sep 17 00:00:00 2001 From: zqran Date: Sat, 10 Sep 2022 20:44:25 +0800 Subject: [PATCH] [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 --- beta/src/content/apis/react/useEvent.md | 22 +++++++++++++++++++ .../learn/separating-events-from-effects.md | 2 +- beta/src/sidebarReference.json | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 beta/src/content/apis/react/useEvent.md diff --git a/beta/src/content/apis/react/useEvent.md b/beta/src/content/apis/react/useEvent.md new file mode 100644 index 00000000..d7eb8c7a --- /dev/null +++ b/beta/src/content/apis/react/useEvent.md @@ -0,0 +1,22 @@ +--- +title: useEvent +--- + + + +This section is incomplete, please see the RFC doc for [useEvent](https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md). + + + + + + +`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) +``` + + + + diff --git a/beta/src/content/learn/separating-events-from-effects.md b/beta/src/content/learn/separating-events-from-effects.md index ecc1d077..2e06424e 100644 --- a/beta/src/content/learn/separating-events-from-effects.md +++ b/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. diff --git a/beta/src/sidebarReference.json b/beta/src/sidebarReference.json index 904a7867..c33b190b 100644 --- a/beta/src/sidebarReference.json +++ b/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",