Libin Song
Libin Song
好奇楼主学历 是985/211么
> react-hooks时代已经没这个东西了,而且第一个例子用react-hooks写的话,得到的结果都是0,而不是0 0 2 3, > > ```js > import React, {useEffect, useState} from 'react'; > > const ComponentTwo = () => { > const [val, setVal] = useState(0); >...
 什么情况下 this.count !== currentCount啊 第n次 请求不是必+1么
>  > 什么情况下 this.count !== currentCount啊 第n次 请求不是必+1么 打扰了.. 就是for循环setTimeout i的值 的基础问题吧 [https://codesandbox.io/s/duoqingqiujingtai-x4f5d](https://codesandbox.io/s/duoqingqiujingtai-x4f5d) 自问自答一波 .. 就是闭包 currentCount在每个作用域里都存了一份 所以每次loadData都是不一样的 this.count 可以看成全局的变量 异步结束完取得是 js stack里存的this.count + 完后的值 大佬这样理解对么?
@andreperegrinah same problem with you https://github.com/JedWatson/react-select/issues/2025 try this it workd
@mjyoung add this resolve: { alias: { 'react': path.resolve(__dirname, '../../node_modules', 'react') } } in my webpack.config.js