ReactDOMFormActions.js — react Source File
Architecture documentation for ReactDOMFormActions.js, a javascript file in the react codebase. 4 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR eb5c215e_675b_b163_eaf6_1c3511e6722b["ReactDOMFormActions.js"] 42892443_e223_3da0_aeb9_e1b32a408fb0["ReactInternalTypes"] eb5c215e_675b_b163_eaf6_1c3511e6722b --> 42892443_e223_3da0_aeb9_e1b32a408fb0 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] eb5c215e_675b_b163_eaf6_1c3511e6722b --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 1c5695a6_6806_ba54_2074_efc779e66da4["ReactSharedInternals"] eb5c215e_675b_b163_eaf6_1c3511e6722b --> 1c5695a6_6806_ba54_2074_efc779e66da4 9b61bdad_4620_0f90_ab09_c1efd8c52c41["ReactDOMSharedInternals"] eb5c215e_675b_b163_eaf6_1c3511e6722b --> 9b61bdad_4620_0f90_ab09_c1efd8c52c41 9c694103_7f39_88d0_6b4d_f9b2ffed5731["ReactFiberConfigDOM.js"] 9c694103_7f39_88d0_6b4d_f9b2ffed5731 --> eb5c215e_675b_b163_eaf6_1c3511e6722b 4ae326e8_2c2e_2843_d5a5_16edbddd103a["ReactFizzConfigDOM.js"] 4ae326e8_2c2e_2843_d5a5_16edbddd103a --> eb5c215e_675b_b163_eaf6_1c3511e6722b f8daa652_1e2b_f62f_5171_e158bbf29a8e["ReactFizzConfigDOMLegacy.js"] f8daa652_1e2b_f62f_5171_e158bbf29a8e --> eb5c215e_675b_b163_eaf6_1c3511e6722b style eb5c215e_675b_b163_eaf6_1c3511e6722b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* 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
*/
import type {Dispatcher} from 'react-reconciler/src/ReactInternalTypes';
import type {Awaited} from 'shared/ReactTypes';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals';
type FormStatusNotPending = {|
pending: false,
data: null,
method: null,
action: null,
|};
type FormStatusPending = {|
pending: true,
data: FormData,
method: string,
action: string | (FormData => void | Promise<void>) | null,
|};
export type FormStatus = FormStatusPending | FormStatusNotPending;
// Since the "not pending" value is always the same, we can reuse the
// same object across all transitions.
const sharedNotPendingObject: FormStatusNotPending = {
pending: false,
data: null,
method: null,
action: null,
};
export const NotPending: FormStatus = __DEV__
? Object.freeze(sharedNotPendingObject)
: sharedNotPendingObject;
function resolveDispatcher() {
// Copied from react/src/ReactHooks.js. It's the same thing but in a
// different package.
const dispatcher = ReactSharedInternals.H;
if (__DEV__) {
if (dispatcher === null) {
console.error(
'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' +
' one of the following reasons:\n' +
'1. You might have mismatching versions of React and the renderer (such as React DOM)\n' +
'2. You might be breaking the Rules of Hooks\n' +
'3. You might have more than one copy of React in the same app\n' +
'See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.',
);
}
}
// Will result in a null access error if accessed outside render phase. We
// intentionally don't throw our own error because this is in a hot path.
// Also helps ensure this is inlined.
return ((dispatcher: any): Dispatcher);
}
export function useFormStatus(): FormStatus {
const dispatcher = resolveDispatcher();
return dispatcher.useHostTransitionStatus();
}
export function useFormState<S, P>(
action: (Awaited<S>, P) => S,
initialState: Awaited<S>,
permalink?: string,
): [Awaited<S>, (P) => void, boolean] {
const dispatcher = resolveDispatcher();
return dispatcher.useFormState(action, initialState, permalink);
}
export function requestFormReset(form: HTMLFormElement) {
ReactDOMSharedInternals.d /* ReactDOMCurrentDispatcher */
.r(/* requestFormReset */ form);
}
Domain
Subdomains
Functions
Dependencies
- ReactDOMSharedInternals
- ReactInternalTypes
- ReactSharedInternals
- ReactTypes
Imported By
Source
Frequently Asked Questions
What does ReactDOMFormActions.js do?
ReactDOMFormActions.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactDOMFormActions.js?
ReactDOMFormActions.js defines 2 function(s): resolveDispatcher, useFormStatus.
What does ReactDOMFormActions.js depend on?
ReactDOMFormActions.js imports 4 module(s): ReactDOMSharedInternals, ReactInternalTypes, ReactSharedInternals, ReactTypes.
What files import ReactDOMFormActions.js?
ReactDOMFormActions.js is imported by 3 file(s): ReactFiberConfigDOM.js, ReactFizzConfigDOM.js, ReactFizzConfigDOMLegacy.js.
Where is ReactDOMFormActions.js in the architecture?
ReactDOMFormActions.js is located at packages/react-dom-bindings/src/shared/ReactDOMFormActions.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free