我想在我的项目中创建一个滑块,我正在使用 react-rangeslider 库。我写了一篇很简单的文章
const Slider = require('react-rangeslider');
var Para = React.createClass({
handleChange: function(value) {
this.setState({
value: value,
});
},
render: function () {
return (
<Slider
value={this.state.value}
orientation="vertical"
onChange={this.handleChange} />
);
}
});
这导致错误
app.js:6873 Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `Para`.
版本"react-rangeslider": "^2.2.0"
我尝试过的其他库是 mdbReact、ReactBootstrapSlider。
我确实看到了类似错误的帖子,但所有这些帖子都以不同的方式导入。