简体   繁体   English

React受控组件的性能问题

[英]Performance issue with React controlled components

I have been using react's controlled components in my application and . 我一直在我的应用程序和中使用react的受控组件。

But I am noticing that as I enter more and more inputs to these form components my page is slowing down badly or even hangs sometime. 但是我注意到,随着我对这些表单组件输入越来越多的输入,我的页面运行速度变慢甚至挂起。

Any clue ? 有什么线索吗?

Sounds like you should look into the key="" attribute. 听起来您应该查看key=""属性。 Most often when react starts to slow down it is related to it doing more work than necessary. 大多数情况下,当反应开始变慢时,这与它所做的多余工作有关。 Another way to improve performance is implementing shouldComponentUpdate , but that should first be necessary later on. 提高性能的另一种方法是实现shouldComponentUpdate ,但是稍后应首先这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM