我正在尝试添加动画以进入我在 React.js 应用程序(http://facebook.github.io/react/docs/animation.html)中的列表。
但是ReactCSSTransitionGroup
会抛出这样的异常:
Uncaught TypeError: Cannot read property '_mockedReactClassConstructor' of undefined
连同警告:
Warning: React.createElement: type should not be null or undefined. It should be a string (for DOM elements) or a ReactClass (for composite components).
warning.js:36
Warning: Only functions or strings can be mounted as React components.
我的组件看起来像:
var List = React.createClass({
render: function () {
var items = this.props.data
.filter(function (item) {
return item.stream;
})
.map(function (item) {
return <div key={item.id}>item.name</div>;
});
return (
<div className="list clearfix">
<ReactCSSTransitionGroup transitionName="example">
{items}
</ReactCSSTransitionGroup>
</div>
);
}
});