Skip to content

[Done] React without JSX #78

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

Merged
merged 3 commits into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion content/docs/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
- id: react-without-es6
title: React Without ES6
- id: react-without-jsx
title: React Without JSX
title: React بدون JSX
- id: reconciliation
title: Reconciliation
- id: refs-and-the-dom
Expand Down
20 changes: 10 additions & 10 deletions content/docs/react-without-jsx.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
id: react-without-jsx
title: React Without JSX
title: React بدون JSX
permalink: docs/react-without-jsx.html
---

JSX is not a requirement for using React. Using React without JSX is especially convenient when you don't want to set up compilation in your build environment.
JSX ليست متطلب لإستخدام React .حيث يمكنك إستخدام React بدون JSX بشكل خاص عندما لاترغب في إعداد مرحلة التصريف في بيئة البناء لديك.

Each JSX element is just syntactic sugar for calling `React.createElement(component, props, ...children)`. So, anything you can do with JSX can also be done with just plain JavaScript.
كل عنصر من JSX هو فقط تجميل صياغي لمناداة الداله `React.createElement(component, props, ...children)`. اذاً، أي شيء يمكن تطبيقه باستخدام JSX من الممكن ايضاً تطبيقه بإستخدام javascript.

For example, this code written with JSX:
كمثال، هذه الشيفرة مكتوبه باستخدام JSX:

```js
class Hello extends React.Component {
Expand All @@ -23,7 +23,7 @@ ReactDOM.render(
);
```

can be compiled to this code that does not use JSX:
وتصرف الى شيفرة على النحو التالي بدون JSX:

```js
class Hello extends React.Component {
Expand All @@ -38,11 +38,11 @@ ReactDOM.render(
);
```

If you're curious to see more examples of how JSX is converted to JavaScript, you can try out [the online Babel compiler](babel://jsx-simple-example).
إذا كنت مهتماً لرؤية المزيد من الامثلة عن كيفية تصريف شيفرة JSX الى javascript, فبإمكانك تجربة [مصرف Babel على الإنترنت](babel://jsx-simple-example).

The component can either be provided as a string, or as a subclass of `React.Component`, or a plain function for stateless components.
يمكن تزويد المكون كسلسلة نصية, أو كصنف فرعي من `React.Component`، أو كدالة مجردة من أجل المُكونات بدون الحالة.

If you get tired of typing `React.createElement` so much, one common pattern is to assign a shorthand:
إن تعبت من كثرة كتابة `React.createElement`، فمن الأساليب الشائعة هي الطريقة المختصرة التالية:

```js
const e = React.createElement;
Expand All @@ -53,7 +53,7 @@ ReactDOM.render(
);
```

If you use this shorthand form for `React.createElement`, it can be almost as convenient to use React without JSX.
إذا إستخدمت هذه الصيغة المختصرة (الثابت e) لأجل `React.createElement`، فسيكون من المناسب تمامًا استخدام React بدون JSX.

Alternatively, you can refer to community projects such as [`react-hyperscript`](https://github.com/mlmorg/react-hyperscript) and [`hyperscript-helpers`](https://github.com/ohanhi/hyperscript-helpers) which offer a terser syntax.
بدلاً من ذلك، تستطيع الرجوع إلى مشاريع مجتمع React مثل [`react-hyperscript`](https://github.com/mlmorg/react-hyperscript) و [`hyperscript-helpers`](https://github.com/ohanhi/hyperscript-helpers) والتي توفر صياغة مختصرة أكثر.

2 changes: 1 addition & 1 deletion content/docs/reference-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ redirect_from:
- [`createElement()`](#createelement)
- [`createFactory()`](#createfactory)

See [Using React without JSX](/docs/react-without-jsx.html) for more information.
إنظر في [إستخدام React بدون JSX](/docs/react-without-jsx.html) للمزيد من المعلومات.

### تحويل العناصر {#transforming-elements}

Expand Down