Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation for AJAX FAQ's #2

Merged
merged 2 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions content/docs/faq-ajax.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---
id: faq-ajax
title: AJAX and APIs
title: AJAX y APIs
permalink: docs/faq-ajax.html
layout: docs
category: FAQ
---

### How can I make an AJAX call?
### ¿Cómo puedo hacer una llamada AJAX?

You can use any AJAX library you like with React. Some popular ones are [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), and the browser built-in [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
Con React, puedes usar cualquier librería AJAX. Algunas de las más populares son [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), y [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), la cual es soportada de manera nativa en la mayoría de navegadores modernos.

### Where in the component lifecycle should I make an AJAX call?
### ¿En cuál ciclo de vida de un componente puedo hacer una llamada AJAX?
kevinwolfcr marked this conversation as resolved.
Show resolved Hide resolved

You should populate data with AJAX calls in the [`componentDidMount`](/docs/react-component.html#mounting) lifecycle method. This is so you can use `setState` to update your component when the data is retrieved.
Deberías de ejecutar tus llamadas AJAX en el ciclo de vida [`componentDidMount`](/docs/react-component.html#mounting). De esta manera, podrás llamar a `setState` para actualizar el componente una vez que hayas recibido tus datos.
kevinwolfcr marked this conversation as resolved.
Show resolved Hide resolved

### Example: Using AJAX results to set local state
### Ejemplo: Utilizar el resultado de una llamada AJAX para actualizar el estado local de un componente

The component below demonstrates how to make an AJAX call in `componentDidMount` to populate local component state.
El siguiente ejemplo demuestra cómo ejecutar una llamada AJAX en `componentDidMount` para poblar el estado local de un componente.
kevinwolfcr marked this conversation as resolved.
Show resolved Hide resolved

The example API returns a JSON object like this:
El API de ejemplo devuelve el siguiente JSON:
kevinwolfcr marked this conversation as resolved.
Show resolved Hide resolved

```
{
Expand Down
2 changes: 1 addition & 1 deletion content/docs/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
- title: FAQ
items:
- id: faq-ajax
title: AJAX and APIs
title: AJAX y APIs
- id: faq-build
title: Babel, JSX, and Build Steps
- id: faq-functions
Expand Down