after I update the value of currentType in this method, I use currentType as a parameter to adjust the interface in the fetchQuestionIdList function, but each time currentType is the value I updated last time. Choose 2 to transmit 1, 3 to transmit 2, and 4 to transmit 3.
is there any way to solve this delay? Or should I not have used it as a parameter in this way, but defined other variables to hold the value of my choice? Is this.setState just for re-rendering?
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) || {}
}