Skip to content
Discussion options

You must be logged in to vote

Have a look at #11013 (reply in thread)

Basically the way that you currently are doing it every render you will initialize that object, which is obviously not what you would want.

Here's the correct way to handle it:

import Uppy from '@uppy/core'
import { Dashboard } from '@uppy/react'
import Webcam from '@uppy/webcam'
import { FC } from 'react'

const Upload: FC<Props> = ({ name }) => {
  const [uppy, setUppy] = useState(null) // note that `uppy` will be `null` on the server-side in this case
  useEffect(() => {
   const uppy = Uppy().use(Webcam)
   setUppy(uppy)
  }, [])

  return <Dashboard uppy={uppy} plugins={['Webcam']} />
}

export default Upload

interface Props {
  name: string
}

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by BjoernRave
Comment options

You must be logged in to vote
1 reply
@ChaitraK2000
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants