Skip to content

Commit 17f82bb

Browse files
Work in progress
1 parent e37f3db commit 17f82bb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

content/docs/faq-ajax.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
---
22
id: faq-ajax
3-
title: AJAX and APIs
3+
title: AJAX و APIs
44
permalink: docs/faq-ajax.html
55
layout: docs
66
category: FAQ
77
---
8+
9+
### كيف يمكنني إجراء استدعاء في AJAX؟ {#how-can-i-make-an-ajax-call}
810

9-
### How can I make an AJAX call? {#how-can-i-make-an-ajax-call}
11+
بإمكانك استخدام أي مكتبة AJAX تريدها مع React. من المكتبات الشائعة هنالك [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), والمكتبة المُضمَّنة مع المتصفح والتي تُدعى [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
1012

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).
13+
### في أي تابع من توابع دورة الحياة يجب عليّ إجراء استدعاء AJAX؟ {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}
1214

13-
### Where in the component lifecycle should I make an AJAX call? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}
15+
يجب عليك الحصول على البيانات عن طريق استدعاء AJAX في تابع دور الحياة [`componentDidMount`](/docs/react-component.html#mounting). وهذا لكي تستطيع استخدام التابع `setState` لتحديث مكوّنك عند استقبال البيانات.
1416

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.
17+
### مثال: استخدام نتائج AJAX لتعيين الحالة المحلية {#example-using-ajax-results-to-set-local-state}
1618

17-
### Example: Using AJAX results to set local state {#example-using-ajax-results-to-set-local-state}
19+
يُوضّح المكوّن التالي كيفيّة إجراء استدعاء AJAX ضمن التابع `componentDidMount` لتعيين الحالة المحليّة للمكوّن.
1820

19-
The component below demonstrates how to make an AJAX call in `componentDidMount` to populate local component state.
20-
21-
The example API returns a JSON object like this:
21+
تُعيد واجهة برمجة التطبيق في هذا المثال كائن JSON مشابه لما يلي:
2222

2323
```
2424
{
@@ -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+
// ملاحظة: من الهام التعامل مع الأخطاء هنا
54+
// catch() بدلًا من من استخدام الكتلة
55+
// لكي لا نقبل الاستثناءات من أخطاء فعليّة في المكوّنات
5656
(error) => {
5757
this.setState({
5858
isLoaded: true,

0 commit comments

Comments
 (0)