Skip to content

Commit 6bbd3e3

Browse files
fonkieQC-L
authored andcommitted
docs(cn): translate content/docs/react-without-jsx.md into Chinese (#177)
* docs(cn): translate content/docs/react-without-jsx.md into Chinese * Update react-without-jsx.md
1 parent c46e7a6 commit 6bbd3e3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

content/docs/react-without-jsx.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
id: react-without-jsx
3-
title: React Without JSX
3+
title: 不使用 JSX 的 React
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+
React 并不强制要求使用 JSX。当你不想在构建环境中配置有关 JSX 编译时,不在 React 中使用 JSX 会更加方便。
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+
每个 JSX 元素只是调用 `React.createElement(component, props, ...children)` 的语法糖。因此,使用 JSX 可以完成的任何事情都可以通过纯 JavaScript 完成。
1010

11-
For example, this code written with JSX:
11+
例如,用 JSX 编写的代码:
1212

1313
```js
1414
class Hello extends React.Component {
@@ -23,7 +23,7 @@ ReactDOM.render(
2323
);
2424
```
2525

26-
can be compiled to this code that does not use JSX:
26+
可以编写为不使用 JSX 的代码:
2727

2828
```js
2929
class Hello extends React.Component {
@@ -38,11 +38,11 @@ ReactDOM.render(
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+
如果你想了解更多 JSX 转换为 JavaScript 的示例,可以尝试使用 [在线 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+
组件可以是字符串,也可以是 `React.Component` 的子类。当组件为无状态组件时,它也可以是一个普通的函数。
4444

45-
If you get tired of typing `React.createElement` so much, one common pattern is to assign a shorthand:
45+
如果你不想每次都键入 `React.createElement`,通常的做法是创建快捷方式:
4646

4747
```js
4848
const e = React.createElement;
@@ -53,7 +53,7 @@ ReactDOM.render(
5353
);
5454
```
5555

56-
If you use this shorthand form for `React.createElement`, it can be almost as convenient to use React without JSX.
56+
如果你使用了 `React.createElement` 的快捷方式,那么在没有 JSX 的情况下使用 React 几乎一样方便。
5757

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.
58+
或者,你也可以参考社区项目,如:[`react-hyperscript`](https://github.com/mlmorg/react-hyperscript) [`hyperscript-helpers`](https://github.com/ohanhi/hyperscript-helpers),它们提供了更简洁的语法。
5959

0 commit comments

Comments
 (0)