re: Building a Simple Virtual DOM from Scratch VIEW POST

FULL DISCUSSION
 

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 => {
      $node.appendChild(render(newVChildren));
      return $node;
    });
  }

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.

 

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

code of conduct - report abuse