DEV Community

Discussion on: The What, Why and How of React (Styles)

Collapse
 
jazkh profile image
jazkh

This is not Pure Component as defined by React doc.
Pure Component is used to avoid re-rendering a component unnecessarily by doing a shallow comparison to check if state has changed. And so it serves a special purpose. You can read more about it on React docs.

This is how you define it.

import React, {PureComponent} from 'react';

class User extends PureComponent {
//some code///
}
Collapse
 
mangel0111 profile image
miguel-penaloza • Edited

Yes, when I say Pure Component was not a reference for the React PureComponent API that's as Base class of React that give you a Component without an implementation of shouldcomponentupdate.

In this case was to mark a difference between a SelfStyled component and non-SelfStyled Components, but you're right I will include a Note indicating that's not the same.

Thanks!