亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

react,this.setState數據更新

react,this.setState數據更新

拉莫斯之舞 2018-07-23 09:35:18
這個方法中我更新currentType的值以后,在fetchQuestionIdList函數中用currentType作為參數去調接口,但是每次currentType都是我上次更新的值,選2傳送1,選3傳送2,選4傳送3....有什么方法解決這種延遲?或者我跟本不應該這樣用它作為參數,而是定義別的變量保存我選的值?this.setState只是用來重新渲染嗎? onClickItemType=(item)=>{     this.setState({        currentType:{            code:item.code,            name:item.name         },        isShowTypeList: false     })     this.fetchQuestionIdList(this.state.navigationCode)}fetchQuestionIdList = async (tfcode) => {     let params = {        navigationCode: tfcode,        typeCode: currentType.code,        diffCode: currentDiff.code,        contentFinalFlag: true,        thirdpartyType: 1     }     let systemQuestions = await matchExcerciseApi.getQuestionList(params) || {}}
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1503 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號