|
1 | 1 | --- |
2 | | -title: "Built-in React APIs" |
| 2 | +title: "Встроенные API React" |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | <Intro> |
6 | 6 |
|
7 | | -In addition to [Hooks](/reference/react) and [Components](/reference/react/components), the `react` package exports a few other APIs that are useful for defining components. This page lists all the remaining modern React APIs. |
| 7 | +В дополнение к [хукам](/reference/react) и [компонентам](/reference/react/components), пакет `react` экспортирует несколько других API, которые полезны для определения компонентов. Эта страница перечисляет все остальные современные API React. |
8 | 8 |
|
9 | 9 | </Intro> |
10 | 10 |
|
11 | 11 | --- |
12 | 12 |
|
13 | | -* [`createContext`](/reference/react/createContext) lets you define and provide context to the child components. Used with [`useContext`.](/reference/react/useContext) |
14 | | -* [`forwardRef`](/reference/react/forwardRef) lets your component expose a DOM node as a ref to the parent. Used with [`useRef`.](/reference/react/useRef) |
15 | | -* [`lazy`](/reference/react/lazy) lets you defer loading a component's code until it's rendered for the first time. |
16 | | -* [`memo`](/reference/react/memo) lets your component skip re-renders with same props. Used with [`useMemo`](/reference/react/useMemo) and [`useCallback`.](/reference/react/useCallback) |
17 | | -* [`startTransition`](/reference/react/startTransition) lets you mark a state update as non-urgent. Similar to [`useTransition`.](/reference/react/useTransition) |
18 | | -* [`act`](/reference/react/act) lets you wrap renders and interactions in tests to ensure updates have processed before making assertions. |
| 13 | +* [`createContext`](/reference/react/createContext) позволяет вам определять и предоставлять контекст дочерним компонентам. Используется с [`useContext`.](/reference/react/useContext) |
| 14 | +* [`forwardRef`](/reference/react/forwardRef) позволяет вашему компоненту предоставлять DOM-узел в качестве рефа родительскому. Используется с [`useRef`.](/reference/react/useRef) |
| 15 | +* [`lazy`](/reference/react/lazy) позволяет отложить загрузку кода компонента до его первого рендеринга. |
| 16 | +* [`memo`](/reference/react/memo) позволяет вашему компоненту пропускать повторные рендеры с теми же пропсами. Используется с [`useMemo`](/reference/react/useMemo) и [`useCallback`.](/reference/react/useCallback) |
| 17 | +* [`startTransition`](/reference/react/startTransition) позволяет пометить обновление состояния как не срочное. Похоже на [`useTransition`.](/reference/react/useTransition) |
| 18 | +* [`act`](/reference/react/act) позволяет обернуть рендеры и взаимодействия в тестах, чтобы гарантировать обработку обновлений перед проверками. |
19 | 19 |
|
20 | 20 | --- |
21 | 21 |
|
22 | | -## Resource APIs {/*resource-apis*/} |
| 22 | +## API ресурсов {/*resource-apis*/} |
23 | 23 |
|
24 | | -*Resources* can be accessed by a component without having them as part of their state. For example, a component can read a message from a Promise or read styling information from a context. |
| 24 | +*Ресурсы* могут быть доступны компоненту без необходимости хранить их в своём состоянии. Например, компонент может прочитать сообщение из Promise или информацию о стилях из контекста. |
25 | 25 |
|
26 | | -To read a value from a resource, use this API: |
| 26 | +Чтобы прочитать значение из ресурса, используйте этот API: |
27 | 27 |
|
28 | | -* [`use`](/reference/react/use) lets you read the value of a resource like a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or [context](/learn/passing-data-deeply-with-context). |
| 28 | +* [`use`](/reference/react/use) позволяет вам прочитать значение ресурса, такого как [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) или [контекст](/learn/passing-data-deeply-with-context). |
29 | 29 | ```js |
30 | 30 | function MessageComponent({ messagePromise }) { |
31 | 31 | const message = use(messagePromise); |
32 | 32 | const theme = use(ThemeContext); |
33 | 33 | // ... |
34 | 34 | } |
35 | | -``` |
| 35 | +``` |
0 commit comments