Swiper elements for React

Upgrading a project to v8 and swiper now uses elements. I cannot seem to get it going though.

I’m using React with Typescript and get the following error in the .tsx file:

Property ‘swiper-container’ does not exist on type ‘JSX.IntrinsicElements’

declare global {
    namespace JSX {
        interface IntrinsicElements {
            'swiper-container': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
        }
    }
}
1 Like

Just to elaborate a bit as I still had some typing issue with this solution, for a full discussion and correct solution refer to: Provide Typescript definition for Element · Issue #6466 · nolimits4web/swiper · GitHub