title: How to take screenshot of a particular div in react js ? I have used "use-screenshot-hook" package but it is taking the screenshot of whole page
body: <pre><code>const ref = createRef(null); 
  const { image, takeScreenshot } = useScreenshot();     
  const imgStyle = { height: height, width: width }    
        const getImage = () =&gt; takeScreenshot({ref});
        const downloadImage = () =&gt; {
          var FileSaver = require('file-saver');
          FileSaver.saveAs(`${image}`, &quot;image.jpg&quot;);
        }
              &lt;button onClick={getImage}&gt;
                Take screenshot
              &lt;/button&gt;
      
              &lt;button onClick={downloadImage}&gt;Download&lt;/button&gt;
              &lt;div  ref={ref}&gt;
                &lt;img id=&quot;scream&quot; style={imgStyle} src={url} height=&quot;448&quot; width=&quot;100%&quot; ref={imgRef}&gt;&lt;/img&gt; //imgRef is for zoom functionality
              &lt;/div&gt;
  </code></pre>
  <p>I need to take screenshot of image  (along with icons dragged over it from another component). I used ref but its still taking screenshot of whole page</p>