Загрузка видео...

Не удалось загрузить видео

На главную

⚛️ 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

Фото профиля George Moller
George Moller2 лет назад

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 ↓

Фото профиля George Moller
George Moller2 лет назад

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 ↓

Фото профиля Shivam Jha
Shivam Jha2 лет назад

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

Фото профиля George Moller
George Moller2 лет назад

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

Фото профиля Pavel Romanov
Pavel Romanov2 лет назад

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

Фото профиля George Moller
George Moller2 лет назад

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

Фото профиля Jamal Ahmad
Jamal Ahmad2 лет назад

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

Фото профиля George Moller
George Moller2 лет назад

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.

Фото профиля Osama
Osama2 лет назад

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

Фото профиля George Moller
George Moller2 лет назад

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.

Похожие видео