Загрузка видео...
Не удалось загрузить видео
⚛️ Do you know what Automatic Batching means in React (v18)? It means that React groups multiple state updates into a single re-render for better performance. ↓
61,817 просмотров • 2 лет назад •via X (Twitter)
Комментарии: 10

I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics and 50+ video animations just like this one. Check them out ↓

I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics and 50+ video animations just like this one. Check them out ↓

Here’s a post explaining this in detail (shameless plug)

Minor correction: it should read we have 3 todos at the end of the last render.

Didn't know about this feature. Would love to see more content on rendering like React Fiber and others

It was super fun to make this so I might just make more about react rendering process Pavel :)

I didn't not understand because the code looks the same at the end

The code is the same. What changes is how react batches updates. Before each setState triggered a new re-render. After React 18, react batches setStates and only does one render at the end.

Count is derived state anyway, needless to use state for it but I understand the topic is something else

You are right, that and the fetch inside useEffect were just added for context. Would derive cont from state and also wouldn't fetch in useEffect.

