O
O
oskar barin2020-05-19 19:03:18
React
oskar barin, 2020-05-19 19:03:18

How to enlarge an image on click?

The site has pictures with the data-zoom attribute.
How to make it so that when clicking on an img with the data-zoom attribute, an image is displayed in a modal window?
Now I have implemented this using the wrapper component, that is, I wrap each image I need in this component and when I click, the image I need is displayed in a modal window.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-05-19
@madrogalo

add a value of type modalSourceImage: null to the state of the application / general wrapper and change it when you click on the url of the image, then in the render something <ModalPicture pic={this.state.modalSourceImage} />like

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question