ReactJS Pure Components are similar to regular class components but with a key optimization. They skip re-renders when the props and state remain the same. While class components are still supported in React, it's generally recommended to use functional components with hooks in new code for better performance and simplicity.
In this article, we will explore what a Pure Component is in React, along with its key features and use cases, with some examples.
Prerequisites
import React from "react";
export default class Test extends React.PureComponent {
render() {
return <h1>Welcome to GeeksforGeeks</h1>;
}
}
Output