E
E
Evgeny Petrov2020-06-21 17:29:11
JavaScript
Evgeny Petrov, 2020-06-21 17:29:11

How to dynamically add a canvas with an image to a div?

Hello!

Ask for advice from the experienced. In general, I have a React application. It is necessary to add the same canvas to another component from one component that has a canvas with an image, i.e. in fact canvas from one component to redraw to another. Another component has only an empty div, I can’t understand how it is possible to write canvas into an empty div.

What it is for: component A (modal window) works with a webcam, takes pictures in canvas. When the photo is taken, click on Save and this image should be redrawn in component B as thumbnails. Now, out of desperation, I add canvas containers with IDs to component B in advance, and then I add images there. But the method is terribly crutch, I would like to hear a more concise version. Especially if in the future there will be not a certain number of thumbnails, but a dynamic one.

Thank you in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question