Skip to content

Commit 15050aa

Browse files
authored
[18] Add stubs for new API references (#4477)
* [18] Add stubs for new API references * Change order/grouping
1 parent 0e999bb commit 15050aa

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

content/docs/hooks-reference.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ If you're new to Hooks, you might want to check out [the overview](/docs/hooks-o
2424
- [`useImperativeHandle`](#useimperativehandle)
2525
- [`useLayoutEffect`](#uselayouteffect)
2626
- [`useDebugValue`](#usedebugvalue)
27+
- [`useDeferredValue`](#usedeferredvalue)
28+
- [`useTransition`](#usetransition)
29+
- [`useId`](#useid)
30+
- [Library Hooks](#library-hooks)
31+
- [`useSyncExternalStore`](#usesyncexternalstore)
32+
- [`useInsertionEffect`](#useinsertioneffect)
2733

2834
## Basic Hooks {#basic-hooks}
2935

@@ -508,3 +514,59 @@ For example a custom Hook that returned a `Date` value could avoid calling the `
508514
```js
509515
useDebugValue(date, date => date.toDateString());
510516
```
517+
518+
### `useDeferredValue` {#usedeferredvalue}
519+
520+
```js
521+
const [deferredValue] = useDeferredValue(value);
522+
```
523+
524+
TODO: description
525+
526+
### `useTransition` {#usetransition}
527+
528+
```js
529+
const [isPending, startTransition] = useTransition();
530+
```
531+
532+
TODO: description
533+
534+
### `useId` {#useid}
535+
536+
```js
537+
const id = useId(value);
538+
```
539+
540+
TODO: description
541+
542+
> Note:
543+
>
544+
> TODO: identifierPrefix
545+
546+
## Library Hooks {#library-hooks}
547+
548+
The following Hooks are provided for library authors to integrate libraries deeply into the React model, and are not typically used in application code.
549+
550+
### `useSyncExternalStore` {#usesyncexternalstore}
551+
552+
```js
553+
const state = useSyncExternalStore(subscribe, snapshot);
554+
```
555+
556+
TODO: description
557+
558+
> Note:
559+
>
560+
> TODO: use-sync-external-store/shim
561+
562+
### `useInsertionEffect` {#useinsertioneffect}
563+
564+
```js
565+
useInsertionEffect(didUpdate);
566+
```
567+
568+
TODO: description
569+
570+
> Note:
571+
>
572+
> TODO: no refs

content/docs/reference-react.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ Suspense lets components "wait" for something before rendering. Today, Suspense
6565
- [`React.lazy`](#reactlazy)
6666
- [`React.Suspense`](#reactsuspense)
6767

68+
### Transitions
69+
70+
*Transitions* are a new concurrent feature introduced in React 18. They allow you to mark updates as transitions, which tells React that they can be interrupted and avoid going back to Suspense fallbacks for already visible content.
71+
72+
- [`React.startTransition`](#starttransition)
73+
- [`React.useTransition`](/docs/hooks-reference.html#usetransition)
74+
6875
### Hooks {#hooks}
6976

7077
*Hooks* are a new addition in React 16.8. They let you use state and other React features without writing a class. Hooks have a [dedicated docs section](/docs/hooks-intro.html) and a separate API reference:
@@ -81,6 +88,12 @@ Suspense lets components "wait" for something before rendering. Today, Suspense
8188
- [`useImperativeHandle`](/docs/hooks-reference.html#useimperativehandle)
8289
- [`useLayoutEffect`](/docs/hooks-reference.html#uselayouteffect)
8390
- [`useDebugValue`](/docs/hooks-reference.html#usedebugvalue)
91+
- [`useDeferredValue`](/docs/hooks-reference.html#usedeferredvalue)
92+
- [`useTransition`](/docs/hooks-reference.html#usetransition)
93+
- [`useId`](/docs/hooks-reference.html#useid)
94+
- [Library Hooks](/docs/hooks-reference.html#library-hooks)
95+
- [`useSyncExternalStore`](/docs/hooks-reference.html#usesyncexternalstore)
96+
- [`useInsertionEffect`](/docs/hooks-reference.html#useinsertioneffect)
8497

8598
* * *
8699

@@ -360,3 +373,15 @@ While this is not supported today, in the future we plan to let `Suspense` handl
360373
>Note:
361374
>
362375
>`React.lazy()` and `<React.Suspense>` are not yet supported by `ReactDOMServer`. This is a known limitation that will be resolved in the future.
376+
377+
### `React.startTransition` {#starttransition}
378+
379+
```js
380+
React.startTransition(callback)
381+
```
382+
383+
TODO: description
384+
385+
> Note:
386+
>
387+
> TODO: useTransition

0 commit comments

Comments
 (0)