账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    react,this.setState数据更新
    21
    0

    这个方法中我更新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) || {}
    }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 、悲, 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部