WhiteX
WhiteX

Reputation: 11

Carousel cannot be used as JSX component problem

I was creating a price tracker for my web scrapping project and the next step was to add a carousel when I added it , shows the following error 'Carousel' cannot be used as a JSX component. Its type 'typeof Carousel' is not a valid JSX element type. Types of construct signatures are incompatible. Type 'new (props: CarouselProps) => Carousel' is not assignable to type 'new (props: any) => Component<any, any, any>'. Type 'Carousel' is missing the following properties from type 'Component<any, any, any>': context, setState, forceUpdate, props, and 2 more.ts(2786)

Iam new so I don't want anything to destroy while adding this is what it shows (https://i.sstatic.net/iiRYf.png)

I saw through various solution in the internet but they didn't work so I am asking help for someone who can fi this error

Upvotes: 1

Views: 158

Answers (1)

Brian Canedo
Brian Canedo

Reputation: 31

I had this issue when I wasn't importing the Carousel correctly. I had to change:

import Carousel from 'react-responsive-carousel'

to:

import { Carousel } from 'react-responsive-carousel'

Upvotes: 0

Related Questions