-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
docs(cn): translate content/warnings/legacy-factories.md into Chinese #113
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fdd04a1
docs(cn): content/warnings/legacy-factories.md into Chinese
seognil 2fc82f2
update(cn): content/warnings/legacy-factories.md improve title
seognil 0fe08bc
update(cn): content/warnings/legacy-factories.md improve translation
seognil 06b08ec
Update legacy-factories.md
QC-L 899a14f
Update legacy-factories.md
QC-L File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
--- | ||
title: React Element Factories and JSX Warning | ||
title: 警告:有关 React 元素工厂和 JSX | ||
layout: single | ||
permalink: warnings/legacy-factories.html | ||
--- | ||
|
||
You probably came here because your code is calling your component as a plain function call. This is now deprecated: | ||
你能到这个页面很可能是因为:你的代码把你的组件直接作为普通的函数来调用。这个方式现在被废弃了: | ||
|
||
```javascript | ||
var MyComponent = require('MyComponent'); | ||
|
||
function render() { | ||
return MyComponent({ foo: 'bar' }); // WARNING | ||
return MyComponent({ foo: 'bar' }); // 警告 | ||
} | ||
``` | ||
|
||
## JSX {#jsx} | ||
|
||
React components can no longer be called directly like this. Instead [you can use JSX](/docs/jsx-in-depth.html). | ||
React 组件现在不再能像这样直接被调用。取而代之的,[你可以使用 JSX](/docs/jsx-in-depth.html)。 | ||
|
||
```javascript | ||
var React = require('react'); | ||
|
@@ -27,9 +27,9 @@ function render() { | |
} | ||
``` | ||
|
||
## Without JSX {#without-jsx} | ||
## 不用 JSX {#without-jsx} | ||
|
||
If you don't want to, or can't use JSX, then you'll need to wrap your component in a factory before calling it: | ||
如果你不希望、或者是不能使用 JSX,那么你需要把你的组件包装成工厂函数然后再调用它: | ||
|
||
```javascript | ||
var React = require('react'); | ||
|
@@ -40,11 +40,11 @@ function render() { | |
} | ||
``` | ||
|
||
This is an easy upgrade path if you have a lot of existing function calls. | ||
当你有一大堆现存的函数调用的时候,这样做是一个简单的升级方式。 | ||
|
||
## Dynamic components without JSX {#dynamic-components-without-jsx} | ||
## 不使用 JSX 的动态组件 {#dynamic-components-without-jsx} | ||
|
||
If you get a component class from a dynamic source, then it might be unnecessary to create a factory that you immediately invoke. Instead you can just create your element inline: | ||
如果从动态来源取得组件类,那么就不需要创建立即调用的工厂函数。相反,你可以直接内联地创建你的元素: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这句话稍微有些生硬,这样修改如何?
|
||
|
||
```javascript | ||
var React = require('react'); | ||
|
@@ -54,6 +54,6 @@ function render(MyComponent) { | |
} | ||
``` | ||
|
||
## In Depth {#in-depth} | ||
## 深入 {#in-depth} | ||
|
||
[Read more about WHY we're making this change.](https://gist.github.com/sebmarkbage/d7bce729f38730399d28) | ||
[查阅更多关于**为什么**我们做出这个变动。](https://gist.github.com/sebmarkbage/d7bce729f38730399d28) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
元素工厂 感觉怪怪的,Element是大写的 要不直接就不要翻译了