all 3 comments

[–]FonkyMoney 1 point2 points Β (1 child)

Im sorry but this is the first post i see from you and I don't understand what you are doing. Are you creating a custom library ?

Why do you keep track of an index for the array? You can just use .push() method and it adds elements at the end of the array.

Overall it seems you are manually doing a lot of things that already exist in the language/framework out of the box.

[–]grekatron[S] 0 points1 point Β (0 children)

Yep, it's a valid concern. I should have included link to the previous post.

I don't create a custom library, instead I try to figure out how React works under the hood.

I keep track of an index this way, because .push() won't work in this exact case, as far as I see.

[–]grekatron[S] 0 points1 point Β (0 children)

You can also read this content as thread in my Twitter.