Skip to content

jeetiss/react-gifs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

dab881c · Sep 3, 2021

History

81 Commits
Mar 29, 2021
Mar 14, 2021
Mar 30, 2021
Sep 3, 2021
Mar 30, 2021
Mar 30, 2021
Mar 27, 2021
Mar 30, 2021
Sep 3, 2021
Sep 3, 2021
Apr 26, 2021
Mar 27, 2021

Repository files navigation

react gifs

Set of react tools for GIF rendering

npm build min+zip size

Features

  • small : Just 4.99 KB gzipped code
  • modular : Use hooks and components that you need
  • fast : Uses web workers for parsing

Getting Started

npm install @react-gifs/tools
import { useWorkerParser, usePlayerState, usePlayback, Canvas } from "@react-gifs/tools";

const Gif = (src) => {
  // default state
  const [state, update] = usePlayerState();

  //  load and parse gif
  useWorkerParser(src, update);

  // updates current index
  usePlayback(state, () => update(({ index }) => ({ index: index + 1 })));

  // render frames
  return <Canvas {...state} />;
};

Demos