我正在尝试使用 ReactCssTransition 但不知何故未调用该事件(componentWillLeave)
这是我的组件
import React, { Component } from 'react'
import TransitionGroup from 'react-addons-css-transition-group'
export default class TransitionComponent extends Component {
constructor(props) {
super(props);
}
render() {
return (
let {componentKey} = this.props
<TransitionGroup transitionName="example" transitionEnterTimeout={500} transitionLeaveTimeout={500}>
<Item key={"item"+componentKey} />
</TransitionGroup>
);
}
}
和子组件
class Item extends Component {
componentDidEnter() {
console.log("component did enter");
}
componentWillLeave(callback) {
console.log("component will leave");
}
render() {
return (
<div>Item</div>
)
}
}
有什么线索吗?谢谢!