我正在使用carousel制作一个spfx web部件,为此,我使用了react-elastic-carousal npm-link,但是当我尝试使用它时,它给我一个错误,比如:
Carousel' cannot be used as a JSX component. Its instance type 'ReactElasticCarousel' is not a valid JSX element.
Type 'ReactElasticCarousel' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.我应该为此做些什么?
发布于 2020-08-28 22:47:31
尝试使用以下方法导入Carousel
import * as Carousel from react-elastic-carousel;发布于 2020-11-26 01:54:56
将此代码添加到compilerOptions部分中的tsconfig.json文件中:
"allowSyntheticDefaultImports":true
因为该组件没有缺省导出。
https://stackoverflow.com/questions/63557400
复制相似问题