Skip to content

Commit cb2da29

Browse files
authored
Update reference-react.md
1 parent 10bc787 commit cb2da29

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

content/docs/reference-react.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,15 @@ React.cloneElement(
180180
)
181181
```
182182

183-
<<<<<<< HEAD
184183
Sao chép và trả về một React element mới bằng cách sử dụng `element` làm điểm bắt đầu. Element kết quả có các props của element gốc kết hợp nông (shallowly) với các props mới. Thành phần con mới sẽ thay thế thành phần con hiện có. `key``ref` từ element gốc sẽ được giữ nguyên.
185-
=======
186-
Clone and return a new React element using `element` as the starting point. `config` should contain all new props, `key`, or `ref`. The resulting element will have the original element's props with the new props merged in shallowly. New children will replace existing children. `key` and `ref` from the original element will be preserved if no `key` and `ref` present in the `config`.
187-
>>>>>>> a11c2534062bd79cc1e6e34db0e149f928df35bb
188184

189185
`React.cloneElement()` gần như là tương đương với:
190186

191187
```js
192188
<element.type {...element.props} {...props}>{children}</element.type>
193189
```
194190

195-
<<<<<<< HEAD
196191
Tuy nhiên, nó cũng sẽ giữ lại các `ref`. Điều này có nghĩa rằng nếu bạn có một thành phần con cùng với một `ref` trên nó, bạn đã vô tình đánh cắp nó từ các thành phần cha. Bạn sẽ nhận được cùng `ref` đính kèm trên element mới của bạn.
197-
=======
198-
However, it also preserves `ref`s. This means that if you get a child with a `ref` on it, you won't accidentally steal it from your ancestor. You will get the same `ref` attached to your new element. The new `ref` or `key` will replace old ones if present.
199-
>>>>>>> a11c2534062bd79cc1e6e34db0e149f928df35bb
200192

201193
API này được giới thiệu như là một giải pháp thay thế cho `React.addons.cloneWithProps()` không được dùng nữa.
202194

0 commit comments

Comments
 (0)