2
import React,{ Component } from 'react';
import { connect } from 'react-redux';
import { itemid } from '../actions/action';
class DetailPage extends Component{
componentWillUpdate(){
this.props.dispatch(itemid([this.props.params.item,`${this.props.params.item}${this.props.params.id}`]))
}
render(){
const { dispatch } = this.props;
return(
<div>
{this.props.params.id}
</div>
)
}
}
function selectstate(state){
return{
state
}
}
export default connect(selectstate)(DetailPage)
// {} this.props.params.item是从反应路由器(路径( '/细节/项目/ ID'))最大调用堆栈大小超出反应
为什么我的调度是无限循环,直到 错误(超出最大调用堆栈大小)