React isn’t a UI library.
It’s mostly a scheduler and a reconciler. The DOM is just one renderer plugged into them.
I read the source and wrote up what’s really in there.
https://t.co/yRrivzwSQx
"I dislike the phrase 'work smarter, not harder' as it assumes you already know what smarter means. In reality, everything is actually really hard—the only way I can learn to work smart is by working very very hard. I think the phrase should be 'work hard, get smart'" —Primeagen
Agree time slicing alone is a metrics hack, but you’re not supposed to use it alone: the other big React 18 feature, Selective (or “partial”) Hydration, is the real win for TTI.
A good mini WebPerf case-study. My favorite part: use React 18 + wrap UI in <Suspense> to make hydration non-blocking (done in slices). This improved Total Blocking Time (⏱ page is blocked from responding to input)
JavaScript performance is bananas, a thread.
Let's write a function to sum the values from a the 'val' property of each element in an array:
function sum(arr) {
let acc = 0;
for (let i = 0; i < arr.length; i++) {
acc += arr[i].val;
}
return acc;
}
1/10
Excellent organizing tool especially for collecting inspiration. Lots of features are covered. Recommend to you all. https://t.co/EoZ6NzZlQb #designtool#awesometool
If the function body runs, that means all the code inside it runs as well.
Any variables you create or arguments you pass are created and evaluated every render.
This is normally not a big deal because JavaScript engines are very fast and can optimize for this kind of thing.