Skip to content

useRiffle()

useRiffle(options): RiffleHandle

Defined in: react/useRiffle.ts:78

Creates one adapter per component instance and returns prop getters plus the imperative handle. options is diffed against the previous render’s inside an effect, so passing a fresh object every render is safe; only what actually changed reaches the engine’s update().

RiffleOptions

RiffleHandle

import { useRiffle } from '@rpxl/riffle/react'
function Stack({ films }: { films: { title: string }[] }) {
const riffle = useRiffle({ count: films.length, cardWidth: 300, cardHeight: 400 })
return (
<div {...riffle.getRootProps()}>
{films.map((film, i) => (
<div key={i} {...riffle.getCardProps(i)}>{film.title}</div>
))}
</div>
)
}