Skip to content

Instantly share code, notes, and snippets.

Created Jun 14, 2021
What would you like to do?
fitty for react
import { useEffect, useRef } from 'react'
import fitty from 'fitty'
export function useFitty() {
const ref = useRef<HTMLDivElement>(null)
useEffect(() => {
if (!ref.current) return
ref.current.addEventListener('fit', (e) => {
}, [ref.current])
return [ref] as const
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment