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就行了

 

[mobx.array] Attempt to read an array index (2) that is out of bounds (1). Please

相关文章:

  • 2021-05-26
  • 2021-10-03
  • 2021-12-05
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-12-29
  • 2021-06-20
  • 2021-09-27
  • 2022-12-23
相关资源
相似解决方案