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///
}
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!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.
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 ofshouldcomponentupdate
.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!