Browse Source
fix: change experimental_useEvent to experimental_useEffectEvent in escape-hatches.md (#5573)
main
LamNVQ
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
beta/src/content/learn/escape-hatches.md
|
|
@ -471,14 +471,14 @@ This is not ideal. You want to re-connect to the chat only if the `roomId` has c |
|
|
|
|
|
|
|
```js |
|
|
|
import { useState, useEffect } from 'react'; |
|
|
|
import { experimental_useEvent as useEvent } from 'react'; |
|
|
|
import { experimental_useEffectEvent as useEffectEvent } from 'react'; |
|
|
|
import { createConnection, sendMessage } from './chat.js'; |
|
|
|
import { showNotification } from './notifications.js'; |
|
|
|
|
|
|
|
const serverUrl = 'https://localhost:1234'; |
|
|
|
|
|
|
|
function ChatRoom({ roomId, theme }) { |
|
|
|
const onConnected = useEvent(() => { |
|
|
|
const onConnected = useEffectEvent(() => { |
|
|
|
showNotification('Connected!', theme); |
|
|
|
}); |
|
|
|
|
|
|
|