Integrations/React

React

A ref and useEffect.

import { useEffect, useRef } from 'react'
import { Zine } from '@zinejs/core'
import { PdfSource } from '@zinejs/pdf'

export function Flipbook() {
  const el = useRef(null)
  useEffect(() => {
    new Zine(el.current, { source: new PdfSource('https://zinejs.com/pdf/sample.pdf') })
  }, [])
  return <div ref={el} />
}