Difference Between React.memo() and PureComponent
Feature | React.memo() | PureComponent |
---|---|---|
Type | Higher order component | Base class component |
Performance | Good for functional components | Good for class components |
Re-render logic | Memoizes based on props | Performs shallow comparison of props and state |
Usage | Functional Components | Class components |
Difference between React.memo() and PureComponent
We know that both `React.memo()` and `PureComponent‘ are maximizing techniques in React to improve performance by intercepting unnecessary re-renders. That is the process of building fast and smooth applications. In this article, we will explore how PureComponent and React.memo work and show you how to use them in your React native applications.
Table of Content
- React.memo()
- PureComponent
- Difference Between React.memo() and PureComponent
- Conclusion