'Webcam' is not a valid JSX element

Has anyone tried to use react-webcam ?

Using it as described results in compile errors

I didn’t expect this, and I’m too newbie when it comes to the most basic of React things…

@ajoslin103 nothing wrong with react-webcam, just tested it. I think there’s two things you should check:

  1. Redwood uses yarn workspaces. So if you followed the install instructions on react-webcam you might have installed it incorrectly. The correct command would be yarn workspace web add react-webcam. Read more about that here: Redwood File Structure | RedwoodJS Docs
  2. The getScreenshot thing is not valid jsx. If you want to pass getScreenshot to the button, you should just do that directly. Something like this:
          <Webcam
            audio={false}
            height={720}
            ref={webcamRef}
            screenshotFormat="image/jpeg"
            width={1280}
            videoConstraints={videoConstraints}
          />
          <button onClick={capture}>Capture photo</button>

Where capture is the screenshot functionality you’re implementing. I’m not familiar with the component so I don’t know if this is the ‘right’ way to do it, but it at least is one potential way.

Good luck!