swiper

Open full view…

Usage with React

ronny-lewandowski
Mon, 23 Apr 2018 06:47:32 GMT

I installed swiper by npm into a SharePoint-SPFx-React-Project (library). I have to export swiper in my library to use swiper by import in a webpart (also SPFx-React). When I then call the constructor I get <mylibrary>.Swiper is not a constructor. From the index.d.ts in Swiper I can read how the class is exported: ---declare module 'swiper' { export = Swiper; } So I used ---export import Swiper = require("swiper"); within my library to export Swiper, so that I can use it in my webpart. If I then try to instantiate Swiper I get the error: Swiper is not a constructor. I use: --- let oSwiper = new Swiper(`.container-${this.uniqueId}`, storeState.dataReducer.swiperOptions); What is wrong with my implementation?

ronny-lewandowski
Mon, 23 Apr 2018 07:38:56 GMT

I used export import Swiper = require(“swiper”);