草庐IT

useEffcet

全部标签

react中使用useEffcet抛出错误“超出最大更新深度”

目录【项目中部分代码】:【说明】:【抛出错误】:“超出最大更新深度”【造成原因】:【例如:】【解决】:【项目中部分代码】://类组件中:一进页面就拿到要notiveType的值,于是写在componentDidMount生命周期里,只在第一次进入页面时调一次,之后不调用classAextendsPureComponent{constructor(props){super(props)this.state={value:'',}}componentDidMount(){this.inputDate();}inputDate=()=>{this.setState({value:pubConent.