How to set a state in a forEach loop using useState hook

后端 未结 0 1837
星月不相逢
星月不相逢 2021-01-14 15:26

I want to transfer data in an array A into a object B, so i doing something like [array].forEach(e => setB({...B, e})), but it seems like when traversing on later element

相关标签:
回答
  • 消灭零回复
提交回复
热议问题