Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created July 25, 2018 04:41
Show Gist options
  • Save ThaddeusJiang/5cc2a40736e4e3d71a332aeed3c2c345 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/5cc2a40736e4e3d71a332aeed3c2c345 to your computer and use it in GitHub Desktop.
React Stateless Functional Component VS. Component VS. PureComponent

比较

  • Stateless Functional Component 仅仅用于展示的组件。

  • Component

  • PureComponent 自动比较 props 和 states 判断是否需要重新渲染组件。

总结

  1. 只用于展示的组件,使用 Stateless Functional Component。
  2. 推荐使用 PureComponent,性能更好,不用手动调优。

funnycoderstar/blog#14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment