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

Translate "AJAX and APIs" to German #115

Merged
merged 3 commits into from
Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 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 und APIs
permalink: docs/faq-ajax.html
layout: docs
category: FAQ
---

### How can I make an AJAX call? {#how-can-i-make-an-ajax-call}
### Wie kann ich einen AJAX-Aufruf machen? {#how-can-i-make-an-ajax-call}

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).
Du kannst jede AJAX-Bibliothek mit React verwenden. Beliebte Bibliotheken sind [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/) und das im Browser integrierte [window.fetch](https://developer.mozilla.org/de/docs/Web/API/Fetch_API).

### Where in the component lifecycle should I make an AJAX call? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}
### Wann im Komponenten-Lifecycle sollte ich einen AJAX-Aufruf machen? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}

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.
Du solltest Daten mit AJAX-Aufrufen in der [`componentDidMount`](/docs/react-component.html#mounting) Lifecycle-Methode laden. So kannst Du `setState` verwenden, um deine Komponente zu aktualisieren, sobald Daten geladen wurden.

### Example: Using AJAX results to set local state {#example-using-ajax-results-to-set-local-state}
### Beispiel: AJAX-Ergebnisse verwenden, um lokalen State zu setzen {#example-using-ajax-results-to-set-local-state}

The component below demonstrates how to make an AJAX call in `componentDidMount` to populate local component state.
Die folgende Komponente demonstriert, wie man einen AJAX-Aufruf in `componentDidMount` macht, um den lokalen Komponenten-State zu setzen.

The example API returns a JSON object like this:
Die Beispiel-API gibt ein JSON-Objekt wie das Folgende zurück:

```
{
Expand Down Expand Up @@ -50,9 +50,9 @@ class MyComponent extends React.Component {
items: result.items
});
},
// Note: it's important to handle errors here
// instead of a catch() block so that we don't swallow
// exceptions from actual bugs in components.
// Hinweis: Es ist wichtig, Fehler hier zu behandeln
// anstatt im einem catch()-Block, damit wir Exceptions von
// echten Bugs in der Komponente unterscheiden können.
(error) => {
this.setState({
isLoaded: true,
Expand Down