【发布时间】:2020-03-28 16:33:20
【问题描述】:
我正在尝试在 react-particles-js 库中将我的参数与我的 JSX 分开。 我将我的参数放在一个对象中:
let options = {
"particles": {
"number": {
"value": 50
},
"size": {
"value": 3
}
},
"interactivity": {
"events": {
"onhover": {
"enable": true,
"mode": "repulse"
}
}
}
}
然后我编写我的 JSX:
<Particles params={options}/>
当我这样做时,我得到了错误
The types of 'interactivity.events.onhover.mode' are incompatible between these types.
Type 'string' is not assignable to type '"repulse" | "grab" | "push" | "remove" | "bubble" | InteractivityMode[] | undefined'. TS2322
我无法导入 InteractivityMode 接口,因为它没有在库中导出。我不确定在这里做什么。
【问题讨论】:
标签: html css reactjs typescript particles.js