stateless functional component

Component vs Stateless Functional component

  1. Component包含内部state,而Stateless Functional Component所有数据都来自props,没有内部state;

  2. Component 包含的一些生命周期函数,Stateless Functional Component都没有,因为Stateless Functional component没有shouldComponentUpdate,所以也无法控制组件的渲染,也即是说只要是收到新的props,Stateless Functional Component就会重新渲染。

  3. Stateless Functional Component 不支持Refs

https://www.cnblogs.com/Unknw/p/6431375.html

猜你喜欢

转载自luqingxuan.iteye.com/blog/2404591
今日推荐