/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
fixtures/flight/src/Button.js
26 строк
585 B
Andrew Clark
Upgrade Server Actions to canary (#27459)
04 окт 2023, 21:51
Не верифицирован
04 окт 2023, 21:51
bfefb22
Код
Авторство
О чём код?
'use client'; import * as React from 'react'; import {useFormStatus} from 'react-dom'; import ErrorBoundary from './ErrorBoundary.js'; function ButtonDisabledWhilePending({action, children}) { const {pending} = useFormStatus(); return ( <button disabled={pending} formAction={action}> {children} </button> ); } export default function Button({action, children}) { return ( <ErrorBoundary> <form> <ButtonDisabledWhilePending action={action}> {children} </ButtonDisabledWhilePending> </form> </ErrorBoundary> ); }