T
T
TheSnegok2021-06-30 13:53:09
JavaScript
TheSnegok, 2021-06-30 13:53:09

How to make your own loader for each picture?

Hello, there is a component in which links to images come in and are displayed through a map, so I did through useState that if one of them is loaded, then instead of loader it shows all the pictures at once, and added useEffect so that if new ones are added, the loader will work again, here code:
60dc4b888b325066938102.png
Question: how to make a loader work for each picture and when updating to old pictures, the loader does not work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew Hecc, 2021-06-30
@TheSnegok

You need to make a separate component for img, which will respond to loading this particular image, and not the general pool from the url.
Everything is exactly the same as you have now, only it is necessary that each picture has its own state that will fix whether it is loaded or not. Not just one common.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question