You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

loading-files.tsx 442B

1234567891011121314151617
  1. import { Tldraw, TDFile } from '@tldraw/tldraw'
  2. import * as React from 'react'
  3. export default function LoadingFiles(): JSX.Element {
  4. const [file, setFile] = React.useState<TDFile>()
  5. React.useEffect(() => {
  6. async function loadFile(): Promise<void> {
  7. const file = await fetch('Example.tldr').then((response) => response.json())
  8. setFile(file)
  9. }
  10. loadFile()
  11. }, [])
  12. return <Tldraw document={file?.document} />
  13. }