docs: Add faq (#34830)

This commit is contained in:
二货机器人 2022-04-01 15:54:11 +08:00 committed by GitHub
parent dd13e806b2
commit 80c1391211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -126,6 +126,10 @@ ConfigProvider.config({
});
```
### Why shouldn't I use component internal props or state with ref?
You should only access the API by official doc with ref. Directly access internal `props` or `state` is not recommended which will make your code strong coupling with current version. Any refactor will break your code like refactor with [Hooks](https://reactjs.org/docs/hooks-intro.html) version, delete or rename internal `props` or `state`, adjust internal node constructor, etc.
### How to spell Ant Design correctly?
- ✅ **Ant Design**: Capitalized with space, for the design language.

View File

@ -140,6 +140,10 @@ ConfigProvider.config({
});
```
### 为什么我不应该通过 ref 访问组件内部的 props 和 state
你通过 ref 获得引用时只应该使用文档提供的方法。直接读取组件内部的 `props``state` 不是一个好的设计,这会使你的代码与组件版本强耦合。任何重构都可能会使你的代码无法工作,其中重构包括且不仅限于改造成 [Hooks](https://reactjs.org/docs/hooks-intro.html) 版本、移除 / 更名内部 `props``state`、调整内部 React 节点结构等等。
### 如何正确的拼写 Ant Design
- ✅ **Ant Design**:用空格分隔的首字母大写单词,指代设计语言。