DEV Community


Discussion on: Building a Simple Virtual DOM from Scratch

virtualkirill profile image
Kirill Vasiltsov

Very good job. Thank you for a thorough guide!
Actually, there is a typo in your code within the post.

  const additionalPatches = [];
  for (const additionalVChild of newVChildren.slice(oldVChildren.length)) {
    additionalPatches.push($node => {
      return $node;
Enter fullscreen mode Exit fullscreen mode

Inside the function that we put into additionalPatches we should render not the newVChildren but the additionalVChild.
This code appears in the first example in the explanation of diffChildren function.

ycmjason profile image
Jason Yu Author

You are a hero! Thanks for pointing that out! 🎉🎉🎉 I'll change it as soon as possible!

maiermic profile image
Michael Maier

This typo is still in the article 😉