zz
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
16 additions and
0 deletions
-
beta/src/content/learn/separating-events-from-effects.md
|
|
@ -796,6 +796,22 @@ With `useEvent`, there is no need to "lie" to the linter, and the code works as |
|
|
|
|
|
|
|
<Sandpack> |
|
|
|
|
|
|
|
```json package.json hidden |
|
|
|
{ |
|
|
|
"dependencies": { |
|
|
|
"react": "experimental", |
|
|
|
"react-dom": "experimental", |
|
|
|
"react-scripts": "latest" |
|
|
|
}, |
|
|
|
"scripts": { |
|
|
|
"start": "react-scripts start", |
|
|
|
"build": "react-scripts build", |
|
|
|
"test": "react-scripts test --env=jsdom", |
|
|
|
"eject": "react-scripts eject" |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
```js |
|
|
|
import { useState, useEffect } from 'react'; |
|
|
|
import { experimental_useEvent as useEvent } from 'react'; |
|
|
|