Tldraw/examples/tldraw-example/src/changing-id.tsx

15 wiersze
328 B
TypeScript
Czysty Zwykły widok Historia

import { Tldraw } from '@tldraw/tldraw'
import * as React from 'react'
2021-09-08 10:16:10 +00:00
2021-09-09 12:32:08 +00:00
export default function ChangingId() {
2021-09-08 10:16:10 +00:00
const [id, setId] = React.useState('example')
React.useEffect(() => {
const timeout = setTimeout(() => setId('example2'), 2000)
return () => clearTimeout(timeout)
}, [])
return <Tldraw id={id} />
2021-09-08 10:16:10 +00:00
}