Skip to content
Advertisement

Screenshot of a tweet in ReactJS [closed]

I need to create a screenshot of a tweet to then store it in a PostgreSQL DB and/or show it in my webpage (show the screenshot) made in ReactJS, with Typescript. I use react-tweet-embed to show the tweet but I’m in need to store the picture of that tweet in my DB.

Does a library exist already with this available?

Advertisement

Answer

Library html2canvas allows you to capture part of a webpage on a canvas.

See: https://html2canvas.hertzen.com/

The issue you might be facing is that this library works with HTML elements. However you may give certain React elements an id, className or use ref.

JavaScript

With code above

JavaScript
Advertisement