Skip to content

Commit

Permalink
Merge pull request #47 from ahmedkaba/react-without-jsx
Browse files Browse the repository at this point in the history
Translation of React Without JSX
  • Loading branch information
alioguzhan committed Mar 14, 2019
2 parents b870d19 + 0e6ac75 commit ffdc2bf
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions content/docs/react-without-jsx.md
@@ -1,14 +1,14 @@
---
id: react-without-jsx
title: React Without JSX
title: JSX Olmadan React
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'i kullanmak için bir gereksinim değildir. JSX olmadan React'i kullanmak özellikle, geliştirme ortamınızda derleme ayarlarıyla uğraşmak istemediğiniz durumlarda daha uygundur.

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.
Her JSX elementi sadece `React.createElement(component, props, ...children)`'i çağırmak için sözdizimsel şekerdir. Yani, JSX ile yapabileceğiniz her şeyi sadece düz JavaScript ile yapabilirsiniz.

For example, this code written with JSX:
Örneğin, bu kod JSX ile yazılmış:

```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 kullanmayan bu koda derlenebilir:

```js
class Hello extends React.Component {
Expand All @@ -38,22 +38,21 @@ 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'in JavaScript'e nasıl dönüştürüldüğüne dair daha fazla örnek görmek isterseniz, [çevrimiçi Babel derleyicisi](babel://jsx-simple-example)ni deneyebilirsiniz.

The component can either be provided as a string, or as a subclass of `React.Component`, or a plain function for stateless components.
Bileşen bir dize olarak veya `React.Component`'in alt sınıfı olarak veya durumsuz bileşenler için düz bir fonksiyon olarak sağlanabilir.

If you get tired of typing `React.createElement` so much, one common pattern is to assign a shorthand:
Eğer çok fazla `React.createElement` yazmaktan bıktıysanız, genel çözüm bir kısaltmaya atamaktır:

```js
const e = React.createElement;

ReactDOM.render(
e('div', null, 'Hello World'),
e('div', null, 'Merhaba Dünya'),
document.getElementById('root')
);
```

If you use this shorthand form for `React.createElement`, it can be almost as convenient to use React without 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.
Eğer bu kısaltma halini `React.createElement` için kullanırsanız, JSX olmadan React'i kullanmak daha pratik olabilir.

Alternatif olarak, [`react-hyperscript`](https://github.com/mlmorg/react-hyperscript) ve [`hyperscript-helpers`](https://github.com/ohanhi/hyperscript-helpers) gibi `terser` sözdizimi sunan topluluk projelerine göz atabilirsiniz.

0 comments on commit ffdc2bf

Please sign in to comment.