Skip to content

Commit d099ca7

Browse files
karpiuMGjakubdrozdek
authored andcommitted
Translate FAQ 'React without JSX' page (#175)
1 parent 721d22e commit d099ca7

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

content/docs/react-without-jsx.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,58 @@
11
---
22
id: react-without-jsx
3-
title: React Without JSX
3+
title: React bez JSX
44
permalink: docs/react-without-jsx.html
55
---
66

7-
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.
7+
JSX nie jest wymagany do korzystania z Reacta. Korzystanie z Reacta bez JSX jest szczególnie wygodne, gdy nie chce się konfigurować kroku kompilacji w środowisku budowania.
88

9-
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.
9+
Każdy element JSX jest jedynie wygodniejszym odpowiednikiem wywołania metody `React.createElement(component, props, ...children)`. Wszystko więc, co da się zrobić korzystając z JSX, można również uzyskać za pomocą zwykłego JavaScriptu.
1010

11-
For example, this code written with JSX:
11+
Na przykład, ten fragment kodu napisany z użyciem JSX:
1212

1313
```js
1414
class Hello extends React.Component {
1515
render() {
16-
return <div>Hello {this.props.toWhat}</div>;
16+
return <div>Witaj, {this.props.toWhat}</div>;
1717
}
1818
}
1919

2020
ReactDOM.render(
21-
<Hello toWhat="World" />,
21+
<Hello toWhat="Świecie" />,
2222
document.getElementById('root')
2323
);
2424
```
2525

26-
can be compiled to this code that does not use JSX:
26+
może być skompilowany do tego kodu, który nie korzysta z JSX:
2727

2828
```js
2929
class Hello extends React.Component {
3030
render() {
31-
return React.createElement('div', null, `Hello ${this.props.toWhat}`);
31+
return React.createElement('div', null, `Witaj, ${this.props.toWhat}`);
3232
}
3333
}
3434

3535
ReactDOM.render(
36-
React.createElement(Hello, {toWhat: 'World'}, null),
36+
React.createElement(Hello, {toWhat: 'Świecie'}, null),
3737
document.getElementById('root')
3838
);
3939
```
4040

41-
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).
41+
Jeśli chcesz zobaczyć więcej przykładów konwersji składni JSX do kodu javascriptowego, wypróbuj [wersję online kompilatora Babel](babel://jsx-simple-example).
4242

43-
The component can either be provided as a string, or as a subclass of `React.Component`, or a plain function for stateless components.
43+
Komponent może być ciągiem znaków, podklasą `React.Component` albo zwykłą funkcją.
4444

45-
If you get tired of typing `React.createElement` so much, one common pattern is to assign a shorthand:
45+
Aby uniknąć ciągłego pisania `React.createElement`, warto zastosować poniższy wzorzec:
4646

4747
```js
4848
const e = React.createElement;
4949

5050
ReactDOM.render(
51-
e('div', null, 'Hello World'),
51+
e('div', null, 'Witaj, Świecie'),
5252
document.getElementById('root')
5353
);
5454
```
5555

56-
If you use this shorthand form for `React.createElement`, it can be almost as convenient to use React without JSX.
57-
58-
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.
56+
Jeśli używa się tej skróconej formy `React.createElement`, korzystanie z Reacta bez JSX może być równie wygodne.
5957

58+
Ewentualnie można zapoznać się z projektami społeczności, takimi jak [`react-hyperscript`](https://github.com/mlmorg/react-hyperscript) czy [`hyperscript-helpers`](https://github.com/ohanhi/hyperscript-helpers), które oferują bardziej zwięzłą składnię.

0 commit comments

Comments
 (0)