Let's learn how modern javascript frameworks work by building one
last updated: Dec 03, 2023
https://nolanlawson.com/2023/12/02/lets-learn-how-modern-javascript-frameworks-work-by-building-one/
- how to build DOM elements quickly
- create them in a
template
element and then clone them:
const template = document.createElement('template') template.innerHTML = ` <div class="blue">Blue!</div> ` template.content.cloneNode(true) // this is fast! - create them in a
queueMicrotask
- https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
-
The
queueMicrotask()
method, which is exposed on theWindow
orWorker
interface, queues a microtask to be executed at a safe time prior to control returning to the browser's event loop. queueMicrotask(() => doSomething())
is very similar todoSomething().resolve().then()
Lots more neat stuff, though some of it is a bit over my head.