mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
53b12e46a1
Starting in version 19, users can import the `act` testing API from the `react` package instead of using a renderer specific API, like `react-dom/test-utils`.
76 lines
1.5 KiB
JavaScript
76 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
export {
|
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
act,
|
|
Children,
|
|
Component,
|
|
Fragment,
|
|
Profiler,
|
|
PureComponent,
|
|
StrictMode,
|
|
Suspense,
|
|
cloneElement,
|
|
createContext,
|
|
createElement,
|
|
createFactory,
|
|
createRef,
|
|
createServerContext,
|
|
use,
|
|
forwardRef,
|
|
isValidElement,
|
|
lazy,
|
|
memo,
|
|
cache,
|
|
startTransition,
|
|
unstable_Cache,
|
|
unstable_DebugTracingMode,
|
|
unstable_Activity,
|
|
unstable_postpone,
|
|
unstable_getCacheSignal,
|
|
unstable_getCacheForType,
|
|
unstable_SuspenseList,
|
|
unstable_useCacheRefresh,
|
|
unstable_useMemoCache,
|
|
useId,
|
|
useCallback,
|
|
useContext,
|
|
useDebugValue,
|
|
useDeferredValue,
|
|
useEffect,
|
|
experimental_useEffectEvent,
|
|
useImperativeHandle,
|
|
useInsertionEffect,
|
|
useLayoutEffect,
|
|
useMemo,
|
|
useOptimistic,
|
|
useReducer,
|
|
useRef,
|
|
useState,
|
|
useSyncExternalStore,
|
|
useTransition,
|
|
version,
|
|
} from './src/ReactClient';
|
|
|
|
import {useOptimistic} from './src/ReactClient';
|
|
|
|
export function experimental_useOptimistic<S, A>(
|
|
passthrough: S,
|
|
reducer: ?(S, A) => S,
|
|
): [S, (A) => void] {
|
|
if (__DEV__) {
|
|
console.error(
|
|
'useOptimistic is now in canary. Remove the experimental_ prefix. ' +
|
|
'The prefixed alias will be removed in an upcoming release.',
|
|
);
|
|
}
|
|
return useOptimistic(passthrough, reducer);
|
|
}
|