Skip to content

Commit f4d49e5

Browse files
committed
doc: add some reading resources
1 parent 5606ede commit f4d49e5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@
431431
)
432432
```
433433

434+
阅读资源:
435+
436+
1. [为什么React元素有一个$$typeof属性?](https://overreacted.io/zh-hans/why-do-react-elements-have-typeof-property/)
437+
434438
**[⬆ 返回顶部](#目录)**
435439

436440
5. ### 如何在 React 中创建组件?
@@ -455,6 +459,27 @@
455459
}
456460
```
457461

462+
通过以上任意方式创建的组件,可以这样使用:
463+
464+
```jsx
465+
<Greeting message="semlinker"/>
466+
```
467+
468+
在 React 内部对函数组件和类组件的处理方式是不一样的,如:
469+
470+
```javascript
471+
// 如果 Greeting 是一个函数
472+
const result = Greeting(props); // <p>Hello</p>
473+
474+
// 如果 Greeting 是一个类
475+
const instance = new Greeting(props); // Greeting {}
476+
const result = instance.render(); // <p>Hello</p>
477+
```
478+
479+
阅读资源:
480+
481+
1. [React 如何区分 Class 和 Function?](https://overreacted.io/zh-hans/how-does-react-tell-a-class-from-a-function/)
482+
458483
**[⬆ 返回顶部](#目录)**
459484

460485
6. ### 何时使用类组件和函数组件?
@@ -572,6 +597,7 @@
572597
阅读资源:
573598
574599
1. [掘金 - 揭密React setState](https://juejin.im/post/5b87d14e6fb9a01a18268caf)
600+
2. [setState 如何知道该做什么?](https://overreacted.io/zh-hans/how-does-setstate-know-what-to-do/)
575601
576602
**[⬆ 返回顶部](#目录)**
577603
@@ -2167,6 +2193,10 @@
21672193
21682194
`constructor()` 函数之外,访问 `this.props` 属性会显示相同的值。
21692195

2196+
阅读资源:
2197+
2198+
1. [为什么我们要写 super(props)?](https://overreacted.io/zh-hans/why-do-we-write-super-props/)
2199+
21702200
**[⬆ 返回顶部](#目录)**
21712201

21722202
92. ### 在 JSX 中如何进行循环?

0 commit comments

Comments
 (0)