2 answers
Pure components are the fastest components which can replace any component with only a render(). It helps you to enhance the simplicity of the code and performance of the application.
codelikepro
· 19 Aug 2022
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
A pure component (React.PureComponent) re-renders only when its props or state actually change, found by a shallow comparison.
class Greeting extends React.PureComponent {
render() { return <h1>Hello {this.props.name}</h1>; }
}
// function-component equivalent
const Greeting2 = React.memo(function ({ name }) {
return <h1>Hello {name}</h1>;
});PureComponentimplementsshouldComponentUpdate()for you: it compares old and new props and state shallowly and skipsrender()if nothing changed. This improves performance by avoiding unnecessary re-renders.- A normal
React.Componentre-renders whenever its parent re-renders orsetStateis called. - Because the comparison is shallow, mutating an object or array in place will not be detected; always create a new object or array when updating.
Doubtly AI
· 24 Oct 2026
AI-verified · Oct 2026
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Your answer
Log in or create a free account to answer this question.