React 简易教程
December 09, 2020 07:12 AM
385 words
1 minutes read
先做 react 介绍
亮点 和 局限。
优化:
PureComponent 是优化 React 应用程序最重要的方法之一,易于实施,只要把继承类从 Component 换成 PureComponent 即可,可以减少不必要的 render 操作的次数,从而提高性能,而且可以少写 shouldComponentUpdate 函数,节省了点代码。
和 vue区别
然后案例 smartbrain
react 简易教程
Component : 不仅包含html css 还有功能,可以之后被复用
就像搭乐高一样搭 Component
自上而下渲染,一个Component 节点修改,只有他孩子节点知道,父母节点不会知道。
具体啥prop在主js里设定,
组件js 的函数里面,prop只是个穿传去的参数 (所以具体prop是啥不知道,他只是个参数啊。具体的在主js里面定义),里面调用 this.prop.prop名
export
但凡要被import的文件 都要export
Lifecycle hooks
https://reactjs.org/docs/react-component.html
component
every time auto triggered
mounting
updating
Unmounting
Chirdren
内部的内容就是它的chirldren
|
代码框架
|