React中的一种很常见的问题是:如果在组件中发送一个请求,
在请求还没有返回的时候卸载了组件,这个时候还会尝试设置这个状态,
会报错。我们需要在hooks中处理这种情况,可以看下是怎样处理的:
const useDataApi = (initialUrl, initialData) => {
const [url, setUrl] = useState(initialUrl);
cons...
Chinese Article | Word Count | Duration | Accuracy | Speed | Backspace | Error | Slogan |
---|---|---|---|---|---|---|---|
《取消数据请求》 | 1028字 | 60.0分钟 | 100% | 84 CPM | 24 次 | 0 | 良好,向更快挑战! |
Suggestion:
可能对按键不够熟悉,或者对输入法不够熟练所导致,不要急慢慢来,先打对把准确率提高,然后逐渐的加快速度,最后才能打准打快。
|
|||||||
Inspirational quotes: You only live once. Make it count.,你只活一次,使它有意义。 ——史蒂夫·乔布斯 | |||||||
What do you think of this article? Give it a rating and let it serve as a guiding light for others |