0

I'm using React, Typescript and Swiper. versions React: 18.2.0 typescript: 5.2.2 swiper: 10.2.0 I get an error when using any property like that: Type '{ children: Element[]; spaceBetween: number; }' is not assignable to type 'IntrinsicAttributes & RefAttributes<SwiperRef> & SwiperProps'. Property 'spaceBetween' does not exist on type 'IntrinsicAttributes & RefAttributes<SwiperRef> & SwiperProps'.

import React from 'react';
import type { FC } from 'react';
import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/css';

interface Props {
  images: string[];
}

const ImageSwiper: FC<Props> = ({ images }) => {
  return (
    <>
      <Swiper spaceBetween={50}>
        {images.map((src, idx) => {
          return (
            <SwiperSlide key={idx}>
              <img src={src} alt='' />
            </SwiperSlide>
          );
        })}
      </Swiper>
    </>
  );
};
export default ImageSwiper;

Found information that you need TypeScript version 5 above. But it did not help

Andrey
  • 1
  • 1

0 Answers0