Matt-Esch / virtual-dom

A Virtual DOM and diffing algorithm
MIT License
11.67k stars 777 forks source link

The key of vNode cannot be 0. #427

Open monkingxue opened 7 years ago

monkingxue commented 7 years ago

When I read the source code of keyIndex function, I found that if I have a vNode with the key is 0, the vNode will be add to free array instead of keys, I am confused.

image

I think the if (child.key) is the source to due to this result.

Is a bug or a special design? if it's a special design, why to design it?