Created
October 10, 2023 20:00
-
-
Save efkann/7516af92aaf5daea1d42295b830eac84 to your computer and use it in GitHub Desktop.
React Experimental Hooks Type Declarations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'react-dom' { | |
interface FormStatusNotPending { | |
pending: false; | |
data: null; | |
method: null; | |
action: null; | |
} | |
interface FormStatusPending { | |
pending: true; | |
data: FormData; | |
method: string; | |
action: string | ((formData: FormData) => void | Promise<void>); | |
} | |
type FormStatus = FormStatusPending | FormStatusNotPending; | |
function experimental_useFormStatus(): FormStatus; | |
function experimental_useFormState<State>( | |
action: (state: State) => Promise<State>, | |
initialState: State, | |
permalink?: string | |
): [state: State, dispatch: () => void]; | |
function experimental_useFormState<State, Payload>( | |
action: (state: State, payload: Payload) => Promise<State>, | |
initialState: State, | |
permalink?: string | |
): [state: State, dispatch: (payload: Payload) => void]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment