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.

Задание 1

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

Задание 2

Tell me how to properly modify elements in an array.

Задание 3

Tell me how to properly remove elements from an array.

Задание 4

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

Задание 5

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

Задание 6

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