- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
30,000 State Changes in React: How Many Re-Renders?
In this video, we dive into the details of React's state update batching mechanism and object equality check. When we make 30,000 state changes using a single setState call, React doesn't re-render the component 30,000 times. Instead, React batches the state updates and performs a single re-render after all the state changes have been applied.
But that's not the only reason why the component re-renders only once. React also uses a shallow equality check (Object.is) to compare the previous state and the new state. In this case, React detects that the previous and new state are equal due to the use of a single object reference, so it assumes that the component doesn't need to be re-rendered and skips the rendering process altogether.
Understanding how React handles state updates and re-renders is crucial for building efficient and performant React applications. In this video, we explore these concepts in depth and provide tips for optimizing your React components for better performance.
Source code: https://github.com/Piyush-Use-Personal/basic-react/blob/what-if/30000-setstate/src/App.tsx
Full playlist: https://www.youtube.com/playlist?list=PLKUkNf4DXn9LgGNZwBUNFD_ZvuTgAdEt4
Видео 30,000 State Changes in React: How Many Re-Renders? канала Classy Endeavors
But that's not the only reason why the component re-renders only once. React also uses a shallow equality check (Object.is) to compare the previous state and the new state. In this case, React detects that the previous and new state are equal due to the use of a single object reference, so it assumes that the component doesn't need to be re-rendered and skips the rendering process altogether.
Understanding how React handles state updates and re-renders is crucial for building efficient and performant React applications. In this video, we explore these concepts in depth and provide tips for optimizing your React components for better performance.
Source code: https://github.com/Piyush-Use-Personal/basic-react/blob/what-if/30000-setstate/src/App.tsx
Full playlist: https://www.youtube.com/playlist?list=PLKUkNf4DXn9LgGNZwBUNFD_ZvuTgAdEt4
Видео 30,000 State Changes in React: How Many Re-Renders? канала Classy Endeavors
css and java script speedart speedcodez playlist speedcodez css React state setState re-rendering performance optimization object equality batching shallow equality performance tips React performance React optimization React setState batching React setState shallow compare React setState performance React setState tips React re-rendering React state management 30 000 State Changes in React: How Many Re-Renders? multiple re-render in react on same state
Комментарии отсутствуют
Информация о видео
1 марта 2023 г. 19:30:10
00:02:04
Другие видео канала
