You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Рэсурсы* — штосьці, да чаго кампаненты могуць атрымаць доступ, не маючы іх як частку ўласнага стану. Напрыклад, кампанент можа прачытаць паведамленне з Promise або інфармацыю пра тэму з кантэксту.
113
-
114
-
Для атрымання даных з рэсурсу, выкарыстоўвайце наступны хук:
115
-
116
-
- [`use`](/reference/react/use) дазваляе атрымліваць значэнні з такіх рэсурсаў, як [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) або [кантэкст](/learn/passing-data-deeply-with-context).
117
-
118
-
```js
119
-
functionMessageComponent({ messagePromise }) {
120
-
constmessage=use(messagePromise);
121
-
consttheme=use(ThemeContext);
122
-
// ...
123
-
}
124
-
```
125
-
126
-
---
127
-
128
109
## Іншыя хукі {/*other-hooks*/}
129
-
=======
130
-
## Other Hooks {/*other-hooks*/}
131
-
>>>>>>> 9e1f5cd590fd066e72dda9022237bee30b499951
132
110
133
111
Гэтыя хукі болей карысныя аўтарам бібліятэк і не часта выкарыстоўваюцца ў кодзе праграм.
134
112
135
-
<<<<<<< HEAD
136
113
- [`useDebugValue`](/reference/react/useDebugValue) дазваляе наладзіць пазнаку, якую React DevTools будзе паказваць для вашага хука.
137
114
- [`useId`](/reference/react/useId) дазваляе кампаненту атрымаць унікальны ідэнтыфікатар. Звычайна выкарыстоўваецца з API спецыяльных магчымасцяў.
138
115
- [`useSyncExternalStore`](/reference/react/useSyncExternalStore) дазваляе кампаненту падпісацца на знешняе сховішча.
139
-
=======
140
-
- [`useDebugValue`](/reference/react/useDebugValue) lets you customize the label React DevTools displays for your custom Hook.
141
-
- [`useId`](/reference/react/useId) lets a component associate a unique ID with itself. Typically used with accessibility APIs.
142
-
- [`useSyncExternalStore`](/reference/react/useSyncExternalStore) lets a component subscribe to an external store.
143
-
* [`useActionState`](/reference/react/useActionState) allows you to manage state of actions.
144
-
>>>>>>> 9e1f5cd590fd066e72dda9022237bee30b499951
116
+
* [`useActionState`](/reference/react/useActionState) дазваляе кіраваць станам дзеянняў.
0 commit comments