react2.default.createClass is not a function
我这边报错react2.default.createClass is not a function 目前还不知道怎么解决 有遇到过这个问题的同学么
我这边报错react2.default.createClass is not a function 目前还不知道怎么解决 有遇到过这个问题的同学么
2017-09-30
使用es6的语法替代,比如
class Root extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
let which = Math.floor(Math.random() * music.length);
$('#player').jPlayer({
ready: function() {
$(this).jPlayer('setMedia', {
mp3: music[which].url
}).jPlayer('play');
},
supplied: 'mp3',
wmode: 'window'
});
$('#music-name').text(music[which].name);
}
componentWillUnmount() {
}
render() {
return (
<div>
<Header />
<div id="player"></div>
<div id="music-name"></div>
<Player />
</div>
);
}
}举报