2021-11-16 16:01:29 +00:00
|
|
|
import { Tldraw, TDFile } from '@tldraw/tldraw'
|
2021-11-11 11:37:57 +00:00
|
|
|
import * as React from 'react'
|
|
|
|
|
|
|
|
export default function LoadingFiles(): JSX.Element {
|
2021-11-16 16:01:29 +00:00
|
|
|
const [file, setFile] = React.useState<TDFile>()
|
2021-11-11 11:37:57 +00:00
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
async function loadFile(): Promise<void> {
|
|
|
|
const file = await fetch('Example.tldr').then((response) => response.json())
|
|
|
|
setFile(file)
|
|
|
|
}
|
|
|
|
|
|
|
|
loadFile()
|
|
|
|
}, [])
|
|
|
|
|
2021-11-16 16:01:29 +00:00
|
|
|
return <Tldraw document={file?.document} />
|
2021-11-11 11:37:57 +00:00
|
|
|
}
|