Regular Components
Regular components in React, whether functional or class-based, re-render whenever their parent component re-renders or when their own state or props change. They don’t perform any checks to determine whether their output should change, which can lead to unnecessary re-renders and decreased performance.
Syntax:
// Syntax for Regular component
import React, { Component } from 'react';
class YourComponent extends Component {
render() {
return
<div>
Your Creativity goes here.....
</div>;
}
}
How does a Pure Component Differ from a Regular Component ?
In React, components are the building blocks of user interfaces. They encapsulate the UI logic and render the UI elements based on the input data. React offers different types of components, including regular components and Pure Components.
Table of Content
- Components in React
- Regular Components
- Benefits of Regular Components
- When to use Regular Components
- Pure Component
- Benefits of Pure Components
- When to use Pure Components
- Difference
- Conclusion
Contact Us