Files
react/packages/react-dom/index.experimental.js
Andrew Clark ca237d6f0a Add back temporary experimental_ aliases for Server Actions APIs (#27461)
This adds back the `experimental_`-prefixed Server Actions APIs to the
experimental builds only, so that apps that use those don't immediately
break when upgrading. The APIs will log a warning to encourage people to
move to the unprefixed version, or to switch to the canary release
channel.

We can remove these in a few weeks after we've given people a chance to
upgrade.

This does not affect the canary builds at all, since they never had the
prefixed versions to begin with.
2023-10-04 15:58:08 -04:00

60 lines
1.6 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 {default as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED} from './src/ReactDOMSharedInternals';
export {
createPortal,
createRoot,
hydrateRoot,
findDOMNode,
flushSync,
hydrate,
render,
unmountComponentAtNode,
unstable_batchedUpdates,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
useFormStatus,
useFormState,
prefetchDNS,
preconnect,
preload,
preloadModule,
preinit,
preinitModule,
version,
} from './src/client/ReactDOM';
import type {FormStatus} from 'react-dom-bindings/src/shared/ReactDOMFormActions';
import {useFormStatus, useFormState} from './src/client/ReactDOM';
export function experimental_useFormStatus(): FormStatus {
if (__DEV__) {
console.error(
'useFormStatus is now in canary. Remove the experimental_ prefix. ' +
'The prefixed alias will be removed in an upcoming release.',
);
}
return useFormStatus();
}
export function experimental_useFormState<S, P>(
action: (S, P) => Promise<S>,
initialState: S,
permalink?: string,
): [S, (P) => void] {
if (__DEV__) {
console.error(
'useFormState is now in canary. Remove the experimental_ prefix. ' +
'The prefixed alias will be removed in an upcoming release.',
);
}
return useFormState(action, initialState, permalink);
}