diff --git a/src/content/learn/updating-objects-in-state.md b/src/content/learn/updating-objects-in-state.md
index ca6585145..1c0a98b45 100644
--- a/src/content/learn/updating-objects-in-state.md
+++ b/src/content/learn/updating-objects-in-state.md
@@ -1,57 +1,57 @@
---
-title: Updating Objects in State
+title: Оновлення об'єктів у стані
---
-State can hold any kind of JavaScript value, including objects. But you shouldn't change objects that you hold in the React state directly. Instead, when you want to update an object, you need to create a new one (or make a copy of an existing one), and then set the state to use that copy.
+У стані може зберігатися будь-який тип значення JavaScript, включаючи об'єкти. Але вам не варто просто змінювати об'єкти, які ви зберігаєте в стані React. Натомість, коли ви хочете оновити об'єкт, вам потрібно створити новий (або зробити копію того, що існує), а потім задати стан, щоб використати цю копію.
-- How to correctly update an object in React state
-- How to update a nested object without mutating it
-- What immutability is, and how not to break it
-- How to make object copying less repetitive with Immer
+- Як правильно оновити об'єкт у стані React
+- Як оновити вкладений об'єкт без того, щоб його змінювати
+- Що таке незмінність та як її не порушити
+- Як зробити копіювання об'єкта менш монотонним за допомогою Immer
-## What's a mutation? {/*whats-a-mutation*/}
+## Що таке мутація? {/*whats-a-mutation*/}
-You can store any kind of JavaScript value in state.
+Ви можете зберігати будь-який тип значення JavaScript у стані.
```js
const [x, setX] = useState(0);
```
-So far you've been working with numbers, strings, and booleans. These kinds of JavaScript values are "immutable", meaning unchangeable or "read-only". You can trigger a re-render to _replace_ a value:
+Поки що ви працювали з числами, рядками та булевими значеннями. Ці типи значень JavaScript є "незмінними", тобто доступними тільки для читання. Ви можете збудити (trigger) повторний рендер, щоб _замінити_ значення:
```js
setX(5);
```
-The `x` state changed from `0` to `5`, but the _number `0` itself_ did not change. It's not possible to make any changes to the built-in primitive values like numbers, strings, and booleans in JavaScript.
+Стан `x` змінився з `0` на `5`, але _число `0`_ не змінилося. У JavaScript неможливо внести зміни до вбудованих примітивних значень, таких як числа, рядки та булеві значення.
-Now consider an object in state:
+Тепер розглянемо об'єкт у стані:
```js
const [position, setPosition] = useState({ x: 0, y: 0 });
```
-Technically, it is possible to change the contents of _the object itself_. **This is called a mutation:**
+Технічно можливо змінити вміст _самого об'єкта_. **Це називається мутацією:**
```js
position.x = 5;
```
-However, although objects in React state are technically mutable, you should treat them **as if** they were immutable--like numbers, booleans, and strings. Instead of mutating them, you should always replace them.
+Проте, хоча об'єкти в стані React технічно можна змінити, вам варто вважати їх незмінними, так само як числа, булеві значення та рядки. Замість того, щоб змінювати їх, краще завжди їх замінювати.
-## Treat state as read-only {/*treat-state-as-read-only*/}
+## Вважайте стан доступним тільки для читання {/*treat-state-as-read-only*/}
-In other words, you should **treat any JavaScript object that you put into state as read-only.**
+Інакше кажучи, вам варто **вважати будь-який об'єкт JavaScript, який ви вкладаєте в стан, доступним тільки для читання.**
-This example holds an object in state to represent the current pointer position. The red dot is supposed to move when you touch or move the cursor over the preview area. But the dot stays in the initial position:
+У цьому прикладі об'єкт зберігається в стані, щоб показувати поточне розташування вказівника. Червона точка повинна рухатися, коли ви водите курсором по області попереднього перегляду. Але ця точка залишається в початковому положенні:
@@ -95,7 +95,7 @@ body { margin: 0; padding: 0; height: 250px; }
-The problem is with this bit of code.
+Помилку допущено в цій частині коду.
```js
onPointerMove={e => {
@@ -104,9 +104,9 @@ onPointerMove={e => {
}}
```
-This code modifies the object assigned to `position` from [the previous render.](/learn/state-as-a-snapshot#rendering-takes-a-snapshot-in-time) But without using the state setting function, React has no idea that object has changed. So React does not do anything in response. It's like trying to change the order after you've already eaten the meal. While mutating state can work in some cases, we don't recommend it. You should treat the state value you have access to in a render as read-only.
+У ній змінюється об'єкт, призначений до `position` з [попереднього рендеру.](/learn/state-as-a-snapshot#rendering-takes-a-snapshot-in-time) Але без використання функції задання стану React не розуміє, що об'єкт змінився. Тому React нічого не робить у відповідь. Це все одно, що ви намагаєтеся змінити замовлення після того, як вже поїли. Хоча мутація стану може спрацювати в деяких випадках, ми не радимо так робити. Вам варто вважати значення стану, до якого ви маєте доступ під час рендеру, доступним тільки для читання.
-To actually [trigger a re-render](/learn/state-as-a-snapshot#setting-state-triggers-renders) in this case, **create a *new* object and pass it to the state setting function:**
+Щоб правильно [збудити повторний рендер](/learn/state-as-a-snapshot#setting-state-triggers-renders) у цьому випадку, **створіть *новий* об'єкт та передайте його у функцію задання стану:**
```js
onPointerMove={e => {
@@ -117,12 +117,12 @@ onPointerMove={e => {
}}
```
-With `setPosition`, you're telling React:
+Використовуючи `setPosition`, ви кажете React:
-* Replace `position` with this new object
-* And render this component again
+* Заміни `position` новим об'єктом
+* І відрендер цей компонент знову
-Notice how the red dot now follows your pointer when you touch or hover over the preview area:
+Погляньте, як червона точка тепер слідує за вашим вказівником, коли ви водите курсором по області попереднього перегляду:
@@ -170,16 +170,16 @@ body { margin: 0; padding: 0; height: 250px; }
-#### Local mutation is fine {/*local-mutation-is-fine*/}
+#### Локальна мутація — це нормально {/*local-mutation-is-fine*/}
-Code like this is a problem because it modifies an *existing* object in state:
+У такому коді, як цей, є помилка, оскільки він змінює об'єкт, що *вже існує* у стані:
```js
position.x = e.clientX;
position.y = e.clientY;
```
-But code like this is **absolutely fine** because you're mutating a fresh object you have *just created*:
+Але код нижче є **абсолютно припустимим**, оскільки ви змінюєте новий об'єкт, який ви *щойно створили*.
```js
const nextPosition = {};
@@ -188,7 +188,7 @@ nextPosition.y = e.clientY;
setPosition(nextPosition);
```
-In fact, it is completely equivalent to writing this:
+Це фактично те саме, що написати таким чином:
```js
setPosition({
@@ -197,15 +197,15 @@ setPosition({
});
```
-Mutation is only a problem when you change *existing* objects that are already in state. Mutating an object you've just created is okay because *no other code references it yet.* Changing it isn't going to accidentally impact something that depends on it. This is called a "local mutation". You can even do local mutation [while rendering.](/learn/keeping-components-pure#local-mutation-your-components-little-secret) Very convenient and completely okay!
+Мутація спричиняє проблеми тільки тоді, коли ви змінюєте об'єкти, що *існують* і вже знаходяться в стані. Змінення об'єкта, який ви щойно створили, є нормальним, оскільки *у жодному іншому коді поки немає посилання на нього.* Якщо змінити його, це не вплине випадково на щось, що залежить від нього. Це називається "локальною мутацією". Локальна мутація допустима навіть [під час рендеру.](/learn/keeping-components-pure#local-mutation-your-components-little-secret) Дуже зручно й абсолютно нормально!
-## Copying objects with the spread syntax {/*copying-objects-with-the-spread-syntax*/}
+## Копіювання об'єктів за допомогою синтаксису розгортання {/*copying-objects-with-the-spread-syntax*/}
-In the previous example, the `position` object is always created fresh from the current cursor position. But often, you will want to include *existing* data as a part of the new object you're creating. For example, you may want to update *only one* field in a form, but keep the previous values for all other fields.
+У попередньому прикладі об'єкт `position` завжди створюється наново відповідно до поточного розташування курсора. Але часто ви захочете включити дані, *що існують*, як частину нового об'єкта, що ви створюєте. Наприклад, ви, можливо, хочете оновити *тільки одне* поле у формі, але залишити попередні значення для всіх інших полів.
-These input fields don't work because the `onChange` handlers mutate the state:
+Ці поля введення не працюють, бо обробники `onChange` змінюють стан:
@@ -214,8 +214,8 @@ import { useState } from 'react';
export default function Form() {
const [person, setPerson] = useState({
- firstName: 'Barbara',
- lastName: 'Hepworth',
+ firstName: 'Барбара',
+ lastName: 'Гепворт',
email: 'bhepworth@sculpture.com'
});
@@ -234,14 +234,14 @@ export default function Form() {
return (
<>