We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
【文中也没有提到到底该不该省略,省略与不省略的区别是什么。】 期待更新~
The text was updated successfully, but these errors were encountered:
元素key属性的作用是用于判断元素是新创建的还是被移动的元素,从而减少不必要的元素渲染。
Sorry, something went wrong.
重新整理了一下哈, key的作用那篇写的比较草, 现在优化了一下.
key
diff算法
null
除非是静态列表渲染, 没有更新动作, 可以省略key.
一般在列表需要二次渲染更新的情况下:
和多节点原理一致, 如果省略了key且在内部使用了state, 二次更新时也有可能造成状态混乱
归根到底, 需要更新的组件省略key不可以, 静态的(永不更新的)组件就可以省略
No branches or pull requests
【文中也没有提到到底该不该省略,省略与不省略的区别是什么。】
期待更新~
The text was updated successfully, but these errors were encountered: