mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-23 18:50:06 +08:00
docs: update note about controlled-components (#51579)
This commit is contained in:
parent
88f2bc187c
commit
6b622e4afb
@ -69,7 +69,7 @@ Please refer to [Use custom date library](/docs/react/use-custom-date-library).
|
||||
|
||||
## It doesn't work when I change `defaultValue` dynamically.
|
||||
|
||||
The `defaultXxxx` (e.g. `defaultValue`) of `Input`/`Select`(etc...) only works on the first render. It is a specification of React. Please read [React's documentation](https://facebook.github.io/react/docs/forms.html#controlled-components).
|
||||
The `defaultXxxx` (e.g. `defaultValue`) of `Input`/`Select`(etc...) only works on the first render. It is a specification of React. Please read [React's documentation](https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable).
|
||||
|
||||
## Why does modifying props in mutable way not trigger a component update?
|
||||
|
||||
@ -77,7 +77,7 @@ antd use shallow compare of props to optimize performance. You should always pas
|
||||
|
||||
## After I set the `value` of an `Input`/`Select`(etc.) component, the value cannot be changed by user's action.
|
||||
|
||||
Try `onChange` to change `value`, and please read [React's documentation](https://reactjs.org/docs/forms.html#controlled-components).
|
||||
Try `onChange` to change `value`, and please read [React's documentation](https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable).
|
||||
|
||||
## Components are not vertically aligned when placed in single row.
|
||||
|
||||
|
@ -69,7 +69,7 @@ antd 在 minor 和 patch 版本迭代中会避免引入破坏性变更,遵从
|
||||
|
||||
## 当我动态改变 `defaultValue` 的时候它并没有生效。
|
||||
|
||||
`Input`/`Select` 等的 `defaultXxxx`(例如 `defaultValue`)只有在第一次渲染的时候有效,这是 React 的规范,请阅读 [React 的文档](https://zh-hans.reactjs.org/docs/forms.html#controlled-components)。
|
||||
`Input`/`Select` 等的 `defaultXxxx`(例如 `defaultValue`)只有在第一次渲染的时候有效,这是 React 的规范,请阅读 [React 的文档](https://zh-hans.react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable)。
|
||||
|
||||
## 为什么修改组件传入的对象或数组属性组件不会更新?
|
||||
|
||||
@ -77,7 +77,7 @@ antd 内部会对 props 进行浅比较实现性能优化。当状态变更,
|
||||
|
||||
## 当我设置了 `Input`/`Select` 等的 `value` 时它就无法修改了。
|
||||
|
||||
尝试使用 `onChange` 来改变 `value`,请参考 [React 的文档](https://zh-hans.reactjs.org/docs/forms.html#controlled-components)。
|
||||
尝试使用 `onChange` 来改变 `value`,请参考 [React 的文档](https://zh-hans.react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable)。
|
||||
|
||||
## 多个组件放一排时没有垂直对齐怎么办?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user