docs: Update Form FAQ (#23138)

* docs: Update Form FAQ

* Update index.en-US.md
This commit is contained in:
二货机器人 2020-04-11 10:30:05 +08:00 committed by GitHub
parent bfd5d7c910
commit 50d908662e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -312,6 +312,10 @@ Before Modal open, children elements do not exist in the view. You can set `forc
Components inside Form.Item with name property will turn into controlled mode, that makes `defaultValue` does not work anymore. Please try `initialValues` of Form to set default value.
### Why resetFields will re-mount component?
`resetFields` will re-mount component under Field to clean up customize component side effect(like asyn data, cached state, etc.). It's by design.
<style>
.site-form-item-icon {
color: rgba(0, 0, 0, 0.25);

View File

@ -313,6 +313,10 @@ validator(rule, value, callback) => {
当你为 Form.Item 设置 `name` 属性后,子组件会转为受控模式。因而 `defaultValue` 不会生效。你需要在 Form 上通过 `initialValues` 设置默认值。
### 为什么 resetFields 会重新 mount 组件?
`resetFields` 会重置整个 Field因而其子组件也会重新 mount 从而消除自定义组件可能存在的副作用(例如异步数据、状态等等)。
<style>
.site-form-item-icon {
color: rgba(0, 0, 0, 0.25);