Start using the carousel is simple!
import { useTransitionCarousel } from 'react-spring-carousel'
export function Component() {
const { carouselFragment } = useTransitionCarousel({
items: mockedItems.map((i) => ({
id: i.id,
renderItem: (
<CarouselItem color={i.color}>
{i.title}
</CarouselItem>
),
})),
});
return (
<div>
{carouselFragment}
</div>
);
}
As you may see, the animation result is slightly different, since the hook that powers this version of the carousel works slightly different. For more information about how it works, you can check here.