Skip to content

Latest commit

 

History

History
executable file
·
24 lines (17 loc) · 469 Bytes

File metadata and controls

executable file
·
24 lines (17 loc) · 469 Bytes

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

usage

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>}
      </>
  )
}