⊗jsrtPmDtInr 72 of 112 menu

Data Reactivity in React

In React, we will store our data in different structures: arrays, objects, arrays of objects. These structures in React are reactive. React reacts to all data changes: adding, deleting, changing elements, as well as changing their order.

At the same time, React rules prohibit changing array and object data from the state. You need to make a copy of the data, change it, and write it back to the state. This means that our data must be immutable. Read about immutability of arrays, objects, and arrays of objects in the corresponding section of the JavaScript tutorial.

Tell me how to properly add elements to an array immutably.

Tell me how to properly modify elements in an array.

Tell me how to properly remove elements from an array.

Tell me how to properly immutably add elements to an array of objects.

Explain how to properly modify elements in an array of objects.

Tell me how to properly remove elements from an array of objects.

enru