main
js 75 lines 1.48 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 export {
11 __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
12 __COMPILER_RUNTIME,
13 Children,
14 Component,
15 Fragment,
16 Profiler,
17 PureComponent,
18 StrictMode,
19 Suspense,
20 cloneElement,
21 createContext,
22 createElement,
23 createRef,
24 use,
25 forwardRef,
26 isValidElement,
27 lazy,
28 memo,
29 cache,
30 cacheSignal,
31 startTransition,
32 optimisticKey,
33 Activity,
34 Activity as unstable_Activity,
35 unstable_getCacheForType,
36 unstable_SuspenseList,
37 ViewTransition,
38 unstable_startGestureTransition,
39 addTransitionType,
40 unstable_useCacheRefresh,
41 useId,
42 useCallback,
43 useContext,
44 useDebugValue,
45 useDeferredValue,
46 useEffect,
47 useEffectEvent,
48 useImperativeHandle,
49 useInsertionEffect,
50 useLayoutEffect,
51 useMemo,
52 useOptimistic,
53 useReducer,
54 useRef,
55 useState,
56 useSyncExternalStore,
57 useTransition,
58 useActionState,
59 version,
60 } from './src/ReactClient';
61
62 import {useOptimistic} from './src/ReactClient';
63
64 export function experimental_useOptimistic<S, A>(
65 passthrough: S,
66 reducer: ?(S, A) => S,
67 ): [S, (A) => void] {
68 if (__DEV__) {
69 console.error(
70 'useOptimistic is now in canary. Remove the experimental_ prefix. ' +
71 'The prefixed alias will be removed in an upcoming release.',
72 );
73 }
74 return useOptimistic(passthrough, reducer);
75 }