[mobx.array] Attempt to read an array index (2) that is out of bounds (1). Please
vconsole.min.js:11 [mobx.array] Attempt to read an array index (2) that is out of bounds (1). Please check length first. Out of bound indices will not be tracked by MobX
使用react的时候报这个警告,要命的是这个组件有个倒计时功能,每一秒都setState这个时间,然后setState每次都重新渲染ender,也就是说每一秒都会报一个这个警告。
原因是mobx使用数组时需要先知道数组长度,但是因为我这边的需求就是长度不知,然后使用了for循环,导致报错,换成map就行了