Skip to content

Commit 514195c

Browse files
committed
[18] Add stubs for new API references
1 parent b5b02e1 commit 514195c

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+
- [Library Hooks](#library-hooks)
30+
- [`useId`](#useid)
31+
- [`useInsertionEffect`](#useinsertioneffect)
32+
- [`useSyncExternalStore`](#usesyncexternalstore)
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+
## Library Hooks {#library-hooks}
535+
536+
The following Hooks are provided for library authors to integrate libraries deeply into the React model, and are not typically used in application code.
537+
538+
### `useId` {#useid}
539+
540+
```js
541+
const id = useId(value);
542+
```
543+
544+
TODO: description
545+
546+
> Note:
547+
>
548+
> TODO: identifierPrefix
549+
550+
### `useInsertionEffect` {#useinsertioneffect}
551+
552+
```js
553+
useInsertionEffect(didUpdate);
554+
```
555+
556+
TODO: description
557+
558+
> Note:
559+
>
560+
> TODO: no refs
561+
562+
### `useSyncExternalStore` {#usesyncexternalstore}
563+
564+
```js
565+
const state = useSyncExternalStore(subscribe, snapshot);
566+
```
567+
568+
TODO: description
569+
570+
> Note:
571+
>
572+
> TODO: use-sync-external-store/shim

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+
- [Library Hooks](/docs/hooks-reference.html#library-hooks)
94+
- [`useId`](/docs/hooks-reference.html#useid)
95+
- [`useInsertionEffect`](/docs/hooks-reference.html#useinsertioneffect)
96+
- [`useSyncExternalStore`](/docs/hooks-reference.html#usesyncexternalstore)
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)