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'))最大調用堆棧大小超出反應
爲什麼我的調度是無限循環,直到 錯誤(超出最大調用堆棧大小)