A Custom Hook which can return images are loaded or not,you can make a loading animation before it return true,or other use.
require react version >=16.8
import useLoadImageAsync from "useLoadImageAsync";
function Demo() {
const complete = useLoadImageAsync([
"image_src1","image_src2","image_src3","image_src4","image_src5"
]);
return (
<>
{complete?<span>loading</span>:<span>loaded</span>}
</>
)
}