Skip to content

Commit 214bb17

Browse files
luiserdefcarburo
andauthored
Translate "useFormStatus" (#918)
* translate useFormStatus * Cambia enlace a versión español * Adjust line numbers --------- Co-authored-by: Rainer Martinez <[email protected]>
1 parent 4d1e181 commit 214bb17

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

src/content/reference/react-dom/hooks/useFormStatus.md

+42-42
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ canary: true
55

66
<Canary>
77

8-
The `useFormStatus` Hook is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
8+
El Hook `useFormStatus` está actualmente disponible solo en React Canary y canales experimentales. Aprende más sobre los [canales de lanzamiento de React aquí](/community/versioning-policy#all-release-channels).
99

1010
</Canary>
1111

1212
<Intro>
1313

14-
`useFormStatus` is a Hook that gives you status information of the last form submission.
14+
`useFormStatus` es un Hook que brinda información de estado del último formulario enviado.
1515

1616
```js
1717
const { pending, data, method, action } = useFormStatus();
@@ -23,19 +23,19 @@ const { pending, data, method, action } = useFormStatus();
2323

2424
---
2525

26-
## Reference {/*reference*/}
26+
## Referencia {/*reference*/}
2727

2828
### `useFormStatus()` {/*use-form-status*/}
2929

30-
The `useFormStatus` Hook provides status information of the last form submission.
30+
El Hook `useFormStatus` provee información de estado del último formulario enviado.
3131

3232
```js {5},[[1, 6, "status.pending"]]
3333
import { useFormStatus } from "react-dom";
3434
import action from './actions';
3535

3636
function Submit() {
3737
const status = useFormStatus();
38-
return <button disabled={status.pending}>Submit</button>
38+
return <button disabled={status.pending}>Enviar</button>
3939
}
4040

4141
export default function App() {
@@ -47,42 +47,42 @@ export default function App() {
4747
}
4848
```
4949

50-
To get status information, the `Submit` component must be rendered within a `<form>`. The Hook returns information like the <CodeStep step={1}>`pending`</CodeStep> property which tells you if the form is actively submitting.
50+
Para obtener información de estado, el componente de `Enviar` tiene que ser renderizado dentro de un `<form>`. El Hook retorna información como la propiedad <CodeStep step={1}>`pending`</CodeStep> que te dice si el formulario se está enviando activamente.
5151

52-
In the above example, `Submit` uses this information to disable `<button>` presses while the form is submitting.
52+
En el ejemplo de arriba, `Enviar` usa esta información para deshabilitar la pulsación de `<button>` mientras el formulario se está enviando.
5353

54-
[See more examples below.](#usage)
54+
[Ver más ejemplos abajo.](#usage)
5555

56-
#### Parameters {/*parameters*/}
56+
#### Parámetros {/*parameters*/}
5757

58-
`useFormStatus` does not take any parameters.
58+
`useFormStatus` no toma ningún parámetro.
5959

60-
#### Returns {/*returns*/}
60+
#### Retorna {/*returns*/}
6161

62-
A `status` object with the following properties:
62+
Un objeto de `status` con las siguientes propiedades:
6363

64-
* `pending`: A boolean. If `true`, this means the parent `<form>` is pending submission. Otherwise, `false`.
64+
* `pending`: Un booleano. Si es `true` significa que el `<form>` padre está pendiente de enviarse. De otro modo es `false`.
6565

66-
* `data`: An object implementing the [`FormData interface`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) that contains the data the parent `<form>` is submitting. If there is no active submission or no parent `<form>`, it will be `null`.
66+
* `data`:Un objeto que implementa la [`interfaz FormData`](https://developer.mozilla.org/es/docs/Web/API/FormData) que contiene los datos que el `<form>` padre está enviando. Si no hay ningún envío activo o no hay `<form>`, va a ser `null`.
6767

68-
* `method`: A string value of either `'get'` or `'post'`. This represents whether the parent `<form>` is submitting with either a `GET` or `POST` [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods). By default, a `<form>` will use the `GET` method and can be specified by the [`method`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#method) property.
68+
* `method`: El valor de un string ya sea `'get'` o `'post'`. Este representa si el `<form>` se está enviando con el [método HTTP](https://developer.mozilla.org/es/docs/Web/HTTP/Methods) `GET` o `POST`. Por defecto, un `<form>` va a usar el método `GET` y puede estar especificado con la propiedad de [`method`](https://developer.mozilla.org/es/docs/Web/HTML/Element/form#method).
6969

7070
[//]: # (Link to `<form>` documentation. "Read more on the `action` prop on `<form>`.")
71-
* `action`: A reference to the function passed to the `action` prop on the parent `<form>`. If there is no parent `<form>`, the property is `null`. If there is a URI value provided to the `action` prop, or no `action` prop specified, `status.action` will be `null`.
71+
* `action`: Una referencia a la función que es pasada al prop de `action` en el `<form>` padre. Si no hay un `<form>` padre, la propiedad es `null`. Si se ha proporcionado un valor URI al prop de `action`, o no se ha especificado un prop de `action`, `status.action` va a ser `null`.
7272

73-
#### Caveats {/*caveats*/}
73+
#### Advertencias {/*caveats*/}
7474

75-
* The `useFormStatus` Hook must be called from a component that is rendered inside a `<form>`.
76-
* `useFormStatus` will only return status information for a parent `<form>`. It will not return status information for any `<form>` rendered in that same component or children components.
75+
* El Hook `useFormStatus` debe llamarse desde un componente que se renderiza dentro de un `<form>`.
76+
* `useFormStatus` solo retornará información de estado para un `<form>` padre. No retornará información de estado a ningún `<form>` renderizado en ese mismo componente o componente hijos.
7777

7878
---
7979

80-
## Usage {/*usage*/}
80+
## Uso {/*usage*/}
8181

82-
### Display a pending state during form submission {/*display-a-pending-state-during-form-submission*/}
83-
To display a pending state while a form is submitting, you can call the `useFormStatus` Hook in a component rendered in a `<form>` and read the `pending` property returned.
82+
### Muestra un estado pendiente durante el envío de un formulario {/*display-a-pending-state-during-form-submission*/}
83+
Para mostrar un estado pendiente mientras un formulario se está enviando, puedes llamar al Hook `useFormStatus` en un componente renderizado en un `<form>` y leer la propiedad `pending` que retorna.
8484

85-
Here, we use the `pending` property to indicate the form is submitting.
85+
Aquí, usamos la propiedad `pending` para indicar que el formulario se está enviando.
8686

8787
<Sandpack>
8888

@@ -94,7 +94,7 @@ function Submit() {
9494
const { pending } = useFormStatus();
9595
return (
9696
<button type="submit" disabled={pending}>
97-
{pending ? "Submitting..." : "Submit"}
97+
{pending ? "Enviando..." : "Enviar"}
9898
</button>
9999
);
100100
}
@@ -133,30 +133,30 @@ export async function submitForm(query) {
133133

134134
<Pitfall>
135135

136-
##### `useFormStatus` will not return status information for a `<form>` rendered in the same component. {/*useformstatus-will-not-return-status-information-for-a-form-rendered-in-the-same-component*/}
136+
##### `useFormStatus` no retorna información de estado a un `<form>` renderizado en el mismo componente. {/*useformstatus-will-not-return-status-information-for-a-form-rendered-in-the-same-component*/}
137137

138-
The `useFormStatus` Hook only returns status information for a parent `<form>` and not for any `<form>` rendered in the same component calling the Hook, or child components.
138+
El Hook `useFormStatus` solo retorna información de estado a un `<form>` padre y no para ningún `<form>` renderizado en el mismo componente que llama el Hook, o componentes hijos.
139139

140140
```js
141141
function Form() {
142-
// 🚩 `pending` will never be true
143-
// useFormStatus does not track the form rendered in this component
142+
// 🚩 `pending` nunca será true
143+
// useFormStatus no rastrea el formulario renderizado en este componente
144144
const { pending } = useFormStatus();
145145
return <form action={submit}></form>;
146146
}
147147
```
148148

149-
Instead call `useFormStatus` from inside a component that is located inside `<form>`.
149+
En su lugar llama a `useFormStatus` desde dentro de un componente que se encuentra dentro de un `<form>`.
150150

151151
```js
152152
function Submit() {
153-
// ✅ `pending` will be derived from the form that wraps the Submit component
153+
// ✅ `pending` se derivará del formulario que envuelve el componente Enviar
154154
const { pending } = useFormStatus();
155155
return <button disabled={pending}>...</button>;
156156
}
157157

158158
function Form() {
159-
// This is the <form> `useFormStatus` tracks
159+
// Este es el <form> que `useFormStatus` rastrea
160160
return (
161161
<form action={submit}>
162162
<Submit />
@@ -167,11 +167,11 @@ function Form() {
167167

168168
</Pitfall>
169169

170-
### Read the form data being submitted {/*read-form-data-being-submitted*/}
170+
### Lee los datos del formulario que se envían {/*read-form-data-being-submitted*/}
171171

172-
You can use the `data` property of the status information returned from `useFormStatus` to display what data is being submitted by the user.
172+
Puedes usar la propiedad `data` de la información de estado que retorna del `useFormStatus` para mostrar qué datos está siendo enviando por el usuario.
173173

174-
Here, we have a form where users can request a username. We can use `useFormStatus` to display a temporary status message confirming what username they have requested.
174+
Aquí, tenemos un formulario donde los usuarios pueden solicitar un nombre de usuario. Podemos usar `useFormStatus` para mostrar temporalmente un mensaje de estado que confirme qué nombre de usuario han solicitado.
175175

176176
<Sandpack>
177177

@@ -184,13 +184,13 @@ export default function UsernameForm() {
184184

185185
return (
186186
<div>
187-
<h3>Request a Username: </h3>
187+
<h3>Solicita un nombre de usuario: </h3>
188188
<input type="text" name="username" disabled={pending}/>
189189
<button type="submit" disabled={pending}>
190-
Submit
190+
Enviar
191191
</button>
192192
<br />
193-
<p>{data ? `Requesting ${data?.get("username")}...`: ''}</p>
193+
<p>{data ? `Solicitando ${data?.get("username")}...`: ''}</p>
194194
</div>
195195
);
196196
}
@@ -249,12 +249,12 @@ button {
249249
250250
---
251251
252-
## Troubleshooting {/*troubleshooting*/}
252+
## Solución de problemas {/*troubleshooting*/}
253253
254-
### `status.pending` is never `true` {/*pending-is-never-true*/}
254+
### `status.pending` nunca es `true` {/*pending-is-never-true*/}
255255
256-
`useFormStatus` will only return status information for a parent `<form>`.
256+
`useFormStatus` solo retornará información de estado a un `<form>` padre.
257257
258-
If the component that calls `useFormStatus` is not nested in a `<form>`, `status.pending` will always return `false`. Verify `useFormStatus` is called in a component that is a child of a `<form>` element.
258+
Si el componente que llama a `useFormStatus` no está anidado en un `<form>`, `status.pending` siempre retornará `false`. Verifica que `useFormStatus` está siendo llamado en un componente que es hijo de un elemento `<form>`.
259259
260-
`useFormStatus` will not track the status of a `<form>` rendered in the same component. See [Pitfall](#useformstatus-will-not-return-status-information-for-a-form-rendered-in-the-same-component) for more details.
260+
`useFormStatus` no rastreará al estado de un `<form>` renderizado en el mismo componente. Mira [Atención](#useformstatus-will-not-return-status-information-for-a-form-rendered-in-the-same-component) para más detalles.

0 commit comments

Comments
 (0)