Skip to content

tykdn/useLoadImageAsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Custom React Hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published