Skip to content

Pass SlideData through a custom component wrapper #7474

Closed Answered by JosuerBague
JosuerBague asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, I just figured it out.

In case anybody needs it:

import * as React from 'react';
import { SwiperSlide, SwiperSlideProps } from 'swiper/react';

type Props = SwiperSlideProps & {
  tag?: string;
  className?: string;
};

const Slide: React.FC<Props> = ({ children, className, tag = 'li', ...props }) => {
  return (
  <SwiperSlide tag={tag} className={className} {...props}>
    {children}
  </SwiperSlide>
)};

Slide.displayName = 'SwiperSlide';

export { Slide };

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JosuerBague
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant