main
js 76 lines 1.49 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 unstable_getCacheForType,
35 unstable_SuspenseList,
36 ViewTransition,
37 unstable_startGestureTransition,
38 addTransitionType,
39 unstable_useCacheRefresh,
40 useId,
41 useCallback,
42 useContext,
43 useDebugValue,
44 useDeferredValue,
45 useEffect,
46 useEffectEvent,
47 useImperativeHandle,
48 useInsertionEffect,
49 useLayoutEffect,
50 useMemo,
51 useOptimistic,
52 useReducer,
53 useRef,
54 useState,
55 useSyncExternalStore,
56 useTransition,
57 useActionState,
58 version,
59 act, // DEV-only
60 captureOwnerStack, // DEV-only
61 } from './src/ReactClient';
62
63 import {useOptimistic} from './src/ReactClient';
64
65 export function experimental_useOptimistic<S, A>(
66 passthrough: S,
67 reducer: ?(S, A) => S,
68 ): [S, (A) => void] {
69 if (__DEV__) {
70 console.error(
71 'useOptimistic is now in canary. Remove the experimental_ prefix. ' +
72 'The prefixed alias will be removed in an upcoming release.',
73 );
74 }
75 return useOptimistic(passthrough, reducer);
76 }