We're a place where coders share, stay up-to-date and grow their careers.
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.
additionalPatches
render
newVChildren
additionalVChild
diffChildren
You are a hero! Thanks for pointing that out! 🎉🎉🎉 I'll change it as soon as possible!
This typo is still in the article 😉
Very good job. Thank you for a thorough guide!
Actually, there is a typo in your code within the post.
Inside the function that we put into
additionalPatches
we shouldrender
not thenewVChildren
but theadditionalVChild
.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!
This typo is still in the article 😉