File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 431
431
)
432
432
` ` `
433
433
434
+ 阅读资源:
435
+
436
+ 1. [为什么React元素有一个$$typeof 属性? ](https: // overreacted.io/zh-hans/why-do-react-elements-have-typeof-property/)
437
+
434
438
** [⬆ 返回顶部](#目录)**
435
439
436
440
5. ### 如何在 React 中创建组件?
455
459
}
456
460
` ` `
457
461
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
+
458
483
** [⬆ 返回顶部](#目录)**
459
484
460
485
6. ### 何时使用类组件和函数组件?
572
597
阅读资源:
573
598
574
599
1. [掘金 - 揭密React setState](https://juejin.im/post/5b87d14e6fb9a01a18268caf)
600
+ 2. [setState 如何知道该做什么?](https://overreacted.io/zh-hans/how-does-setstate-know-what-to-do/)
575
601
576
602
**[⬆ 返回顶部](#目录)**
577
603
2167
2193
2168
2194
在 ` constructor ()` 函数之外,访问 `this.props` 属性会显示相同的值。
2169
2195
2196
+ 阅读资源:
2197
+
2198
+ 1. [为什么我们要写 super(props)?](https:// overreacted.io/zh-hans/why-do-we-write-super-props/)
2199
+
2170
2200
**[⬆ 返回顶部](#目录)**
2171
2201
2172
2202
92. ### 在 JSX 中如何进行循环?
You can’t perform that action at this time.
0 commit comments