score:1

Accepted answer

you could do:

var image = new image();
image.onload = () => setblogbanner(image.src)
image.src = `$ {hlp.backend_host} / images / blogbanners / $ {props.blog.image}`

which will preload the image, and if it loads successfully, you set the blog banner value to that src.


Related Query

More Query from same tag