问题描述
我正在使用轮播制作spfx Web部件,为此,我使用的是反应弹性轮播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.
我应该怎么做?
解决方法
尝试使用以下方法导入轮播
import * as Carousel from react-elastic-carousel;
,
将其添加到您的compileOptions部分中的tsconfig.json文件中:
“ allowSyntheticDefaultImports”:是
因为该组件没有默认导出。