-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
1.3.26 版本中更新useState不会触发渲染 #4996
Comments
CC @Chen-jj |
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
你是直接改的selectFilter数组,reference是没有变得。你应该是setState一个新数组就行了。 |
同样的问题。 setState一个新对象、数组能解决。
|
@LetterYan @dpyzo0o 正解,原因是你直接改了 selectFilter 内属性。你可以用 React 试试,也是跑不了的。 https://reactjs.org/docs/hooks-reference.html#bailing-out-of-a-state-update |
问题描述
更新useSatate没有触发渲染组件
复现步骤
期望行为
更新state后触发渲染。
系统信息
👽 Taro v1.3.26
Taro CLI 1.3.26 environment info:
System:
OS: macOS 10.15.1
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
npmPackages:
@tarojs/async-await: 1.3.26 => 1.3.26
@tarojs/components: 1.3.26 => 1.3.26
@tarojs/plugin-babel: 1.3.26 => 1.3.26
@tarojs/plugin-csso: 1.3.26 => 1.3.26
@tarojs/plugin-sass: 1.3.26 => 1.3.26
@tarojs/plugin-uglifyjs: 1.3.26 => 1.3.26
@tarojs/router: 1.3.26 => 1.3.26
@tarojs/taro: 1.3.26 => 1.3.26
@tarojs/taro-alipay: 1.3.26 => 1.3.26
@tarojs/taro-h5: 1.3.26 => 1.3.26
@tarojs/taro-swan: 1.3.26 => 1.3.26
@tarojs/taro-tt: 1.3.26 => 1.3.26
@tarojs/taro-weapp: 1.3.26 => 1.3.26
@tarojs/webpack-runner: 1.3.26 => 1.3.26
eslint-config-taro: 1.3.26 => 1.3.26
eslint-plugin-taro: 1.3.26 => 1.3.26
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
react: ^16.12.0 => 16.12.0
stylelint-config-taro-rn: 1.3.26 => 1.3.26
stylelint-taro-rn: 1.3.26 => 1.3.26
补充信息
不是每一个更新state都不会触发渲染,但这个组件在1.3.26里确实每次都不会被触发。
The text was updated successfully, but these errors were encountered: