U
U
uRoot2021-09-15 18:13:23
JavaScript
uRoot, 2021-09-15 18:13:23

How to know that the picture was loaded by the browser?

There are components News and NewsItem. Clicking on NewsItem -- the state is set to News and the desired NewsItem is opened. The problem is that if we clicked on a NewsItem, then an image is loaded into it:

<img className="news-item__image" src={`${apiBaseUrl}posts/image/${mediaId}`}/>

We clicked on the same NewsItem three times - three times we went to get the file. How to fix it so that we go for the file only once, and the next time we take it from the cache?
61420d6974f0b705789802.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2021-09-15
@Stalker_RED

It works out of the box that way.
Perhaps your image url is different or the cache is disabled in the headers.
Show image captions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question