T
T
testtostertest1112018-12-28 19:04:09
JavaScript
testtostertest111, 2018-12-28 19:04:09

How to display something else instead of an image in react until it has loaded?

How to display something else instead of an image in react until it has loaded? And when loaded, then display it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2018-12-28
@testtostertest111

{isLoading ? <Loader/> : <SomeContent/>}

Y
Yura Khlyan, 2018-12-28
@MAGistr_MTM

1. At the beginning, to statedo isImgLoading: true
2. Send a request for a picture
3. Send a response to the ambassador with a picture isImgLoading: false
4. PROFIT
Component something like Vitaliy's answer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question