Skip to content

Commit 16caab5

Browse files
committed
Translate 'AJAX and APIs'
1 parent 9103051 commit 16caab5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Diff for: content/docs/faq-ajax.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
22
id: faq-ajax
3-
title: AJAX and APIs
3+
title: AJAX i API
44
permalink: docs/faq-ajax.html
55
layout: docs
66
category: FAQ
77
---
88

9-
### How can I make an AJAX call? {#how-can-i-make-an-ajax-call}
9+
### Jak mogę wykonać zapytanie AJAX? {#how-can-i-make-an-ajax-call}
1010

11-
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).
11+
Możesz użyć dowolnej biblioteki AJAX. Do najpopularniejszych wyborów należą: [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/) oraz wbudowane w przeglądarki [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
1212

13-
### Where in the component lifecycle should I make an AJAX call? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}
13+
### W którym momencie cyklu życia komponentu powinno się wykonać zapytanie AJAX? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}
1414

15-
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.
15+
Dane należy uzupełniać z wykorzystaniem zapytań AJAX w metodzie [`componentDidMount`](/docs/react-component.html#mounting). Dzięki temu po pobraniu danych możliwe będzie użycie metody `setState` do zmodyfikowania stanu komponentu.
1616

17-
### Example: Using AJAX results to set local state {#example-using-ajax-results-to-set-local-state}
17+
### Przykład: Używanie rezultatu zapytania AJAX do ustawienia lokalnego stanu {#example-using-ajax-results-to-set-local-state}
1818

19-
The component below demonstrates how to make an AJAX call in `componentDidMount` to populate local component state.
19+
Niniejszy przykład pokazuje, jak wykonując zapytania AJAX w metodzie `componentDidMount` można zmodyfikować stan komponentu.
2020

21-
The example API returns a JSON object like this:
21+
Nasze przykładowe API zwraca następujący obiekt JSON:
2222

2323
```
2424
{
2525
"items": [
26-
{ "id": 1, "name": "Apples", "price": "$2" },
27-
{ "id": 2, "name": "Peaches", "price": "$5" }
28-
]
26+
{ "id": 1, "name": "Jabłka", "price": "2 zł" },
27+
{ "id": 2, "name": "Brzoskwinie", "price": "5 zł" }
28+
]
2929
}
3030
```
3131

@@ -50,9 +50,9 @@ class MyComponent extends React.Component {
5050
items: result.items
5151
});
5252
},
53-
// Note: it's important to handle errors here
54-
// instead of a catch() block so that we don't swallow
55-
// exceptions from actual bugs in components.
53+
// Uwaga: to ważne, żeby obsłużyć błędy tutaj, a
54+
// nie w bloku catch(), aby nie przetwarzać błędów
55+
// mających swoje źródło w komponencie.
5656
(error) => {
5757
this.setState({
5858
isLoaded: true,
@@ -65,9 +65,9 @@ class MyComponent extends React.Component {
6565
render() {
6666
const { error, isLoaded, items } = this.state;
6767
if (error) {
68-
return <div>Error: {error.message}</div>;
68+
return <div>Błąd: {error.message}</div>;
6969
} else if (!isLoaded) {
70-
return <div>Loading...</div>;
70+
return <div>Ładowanie...</div>;
7171
} else {
7272
return (
7373
<ul>

0 commit comments

Comments
 (0)