How StepNumber gets Updated

From where the step number value gets updated

when we do the setState
we update the stepnumber right ?

From where it gets the value

  1. initialized history

const history = {squares :arr(9).fill(null)}

//from this history.length

  1. history object inside the setState function

//from updated history.length inside setState function

Detailed explination : https://ide.codingblocks.com/s/295663

StepNumber gets its value from the current value of history variable. i.e from (2). But also note that the history.concat() call does not modify the original history variable. So if we append one element using history.concat(), then the value of new StepNumber will be one less than history.concat()

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.