0

I received an array of objects from nodejs server, a = [{...},{...},{...}....]. But when I tried to assign the entire array to a react state using setArray(a), only the first element was assigned to the state.

To find out why, I console.log(a) the array to see what's in it, but what's showing on the console really confuses me:enter image description here

I suppose the (6) here means length is 6 but if I expand it only one element is visible.

but if I

for(const x of a ){
  console.log(x)
  }

all six objects are printed. Did I do something wrong?

zxcisnoias
  • 494
  • 3
  • 19
  • [is-chrome-s-javascript-console-lazy-about-evaluating-objects](https://stackoverflow.com/questions/4057440/is-chrome-s-javascript-console-lazy-about-evaluating-objects) - the rest then comes down to "is missing debugging details", you don't show enough code to tell, what's going wrong. – ASDFGerte Sep 04 '22 at 16:05

0 Answers0