如何解决文本输入的反应状态真的很慢
我有一个文本输入,如下所示:
<input
placeholder="Search by City,Zip Code,or Name"
type="text"
className="searchBar"
value={this.state.search}
onChange={(e) => this.setState({ search: e.target.value })}
onKeyDown={this.keySearch}
></input>
我在这里的问题是,我输入了hello一词。仅在5秒钟后才会显示,并且我键入的每种字母都需要5秒钟才能出现在文本输入中。应该是瞬时的。
这不是浏览器或计算机问题。
在我网站的另一页上,输入的文字与上面的文字相似,非常好。
这是因为我的构造函数中有很多状态吗?
constructor(props) {
super(props);
this.state = {
shops: [],burger: "0",pointerEvents: "none",width: "30px",logout: "none",login: "flex",loadingMAP: true,search: "",modal: true,addresses: [],currentPosition: {},userLocation: { lat: 39.0119,lng: -98.4842 },zoom: 4,loadingMAP2: "block",dashboard: "none",FetchingData: "block",showMap: "flex",gridlistDisplay: "flex",showmaptext: "Show map",MapBoxDisplay: "block",loadingShopBusinesses: "none",shopbusinessesmapbox: [],count: 0,};
}
这是另一个问题吗?
请帮忙,谢谢。
我的完整代码:
https://gist.github.com/rherugu/510fabd4dd89da080a843f61ec1881e0
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。