use-frame
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

use-frame

Sync animation frames in React. Powered by framesync.

Install

npm install use-frame

Usage

import { useState } from "react"
import { useFrame } from "use-frame"

export default function App() {
  const [currentTime, setCurrentTime] = useState(0)

  useFrame(({ timestamp }) => {
    setCurrentTime(timestamp)
  })

  return <div>Time Elapsed: {currentTime}</div>
}

Package Sidebar

Install

npm i use-frame

Weekly Downloads

37

Version

0.2.1

License

MIT

Unpacked Size

8.14 kB

Total Files

6

Last publish

Collaborators

  • souporserious