docs: update note about Table key (#51551)

This commit is contained in:
lijianan 2024-11-09 17:13:33 +08:00 committed by GitHub
parent f7609a04a7
commit 80030b9845
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -349,7 +349,7 @@ Here is the [CodeSandbox for TypeScript](https://codesandbox.io/s/serene-platfor
## Note
According to the [React documentation](https://facebook.github.io/react/docs/lists-and-keys.html#keys), every child in an array should be assigned a unique key. The values inside the Table's `dataSource` and `columns` should follow this rule. By default, `dataSource[i].key` will be treated as the key value for `dataSource`.
According to the [React documentation](https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key), every child in an array should be assigned a unique key. The values inside the Table's `dataSource` and `columns` should follow this rule. By default, `dataSource[i].key` will be treated as the key value for `dataSource`.
![console warning](https://os.alipayobjects.com/rmsportal/luLdLvhPOiRpyss.png)

View File

@ -352,7 +352,7 @@ TypeScript 里使用 Table 的 [CodeSandbox 实例](https://codesandbox.io/s/ser
## 注意
按照 [React 的规范](https://zh-hans.reactjs.org/docs/lists-and-keys.html#keys),所有的数组组件必须绑定 `key`。在 Table 中,`dataSource` 和 `columns` 里的数据值都需要指定 `key` 值。对于 `dataSource` 默认将每列数据的 `key` 属性作为唯一的标识。
按照 [React 的规范](https://zh-hans.react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key),所有的列表必须绑定 `key`。在 Table 中,`dataSource` 和 `columns` 里的数据值都需要指定 `key` 值。对于 `dataSource` 默认将每列数据的 `key` 属性作为唯一的标识。
![控制台警告](https://os.alipayobjects.com/rmsportal/luLdLvhPOiRpyss.png)