title: How to get webcam feed with react hooks?
body: <p>I am trying to get a webcam feed to display on my app using react hooks. I also need to be able to capture the latest image from the feed</p>
  
  <p>I believe I have the foundations but am missing something.</p>
  
  <pre><code>import React,{useState,useEffect} from "react"
  
  
  export function VideoFeed(){
  const[constraints] = useState({width:300,height:300})
  
  useEffect(()=&gt;{
      navigator.mediaDevices.getUserMedia({video:true})
      .then(stream=&gt;{
          let video = document.querySelector('video')
          video.source = stream;
          video.play();
      })
      .catch(e=&gt;{
          console.log(e)
      })
  })
  
  return(
      &lt;video autoPlay ={true} id ="video"&gt;&lt;/video&gt;
  )
  }
  </code></pre>