'react-flow-renderer export as image

I am using "react-flow-renderer" library to draw a diagram in my react project. I have to implement "export as image" functionality so that i can export the generated diagram as a png/jpeg. Library doesn't implement this functionality and i am not able to make it work by drawing on canvas.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source