Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setState的回调中再次设置一次setState,此时打印this.state.xxx为undefined #9599

Closed
fanlvwen opened this issue Jun 24, 2021 · 3 comments
Assignees
Labels
T-alipay Target - 编译到支付宝小程序 V-3 Version - 3.x

Comments

@fanlvwen
Copy link

相关平台

支付宝小程序

复现仓库

https://github.com/fanlvwen/demo/blob/main/setState%20err
小程序基础库: 1.24.10
使用框架: Nerv

复现步骤

重现链接中的代码直接运行 npm run dev:alipay 即可复现 打印皆为undefined

注释掉996行的第一个setState,打印正常

期望结果

多次setState能正常打印

实际结果

多次setState打印undefined

环境信息

Taro CLI 3.2.13 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.17.1 - D:\nodejs\node.EXE
      Yarn: 1.22.10 - C:\Users\user\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.13 - D:\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-nerv T-alipay Target - 编译到支付宝小程序 V-3 Version - 3.x labels Jun 24, 2021
@fanlvwen
Copy link
Author

image
image

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 7, 2021

@fanlvwen 是 nervjs 的问题,React 没有这个问题。

nervjs 不够人力维护了,建议换成 React 吧。

@fanlvwen
Copy link
Author

@Chen-jj 定位到问题了,还是nervjs的原因,将framework换成react就好了 这个 #9597 也是同样的问题,我切到react上就好了

@Chen-jj Chen-jj closed this as completed Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-alipay Target - 编译到支付宝小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

3 participants