How to use setState in React - Managing Complex Objects

preview_player
Показать описание
In this Nibble, we show a typical issue in React applications regarding their state management.

Note: I am using the class-components and not the more modern functional components with hooks because this is what we see currently in the "wild".

0:00 - 6:42 Intro
6:43 - 7:28 InfoBox - Shallow Copy
7:29 - 13:53 How to make it right

Examples:
Changing state in place, then calling setState

Object in state:

Array in state:

setState Explained:

PureComponent:

Рекомендации по теме
welcome to shbcf.ru