How To Load Image On Canvas In React?
How to upload Image to the full width/height of the canvas in React? for example: will appreciated any help.
Solution 1:
You can try something like this
componentDidMount() {
const context = this.canvasA.getContext('2d');
const image = new Image();
image.src = "whereever-you-image-url-live.jpg";
image.onload = () => {
context.drawImage(image, 0, 0, this.canvasA.width, this.canvasA.height);
};
}
Post a Comment for "How To Load Image On Canvas In React?"