Pure Component in React Js
App.js:
import React,{ PureComponent} from "react";
class App extends PureComponent
{
constructor()
{
super();
this.state={count:1}
}
render()
{
console.warn("Check Re-rendring")
return(
<div>
<h1>App Component: {this.state.count}</h1>
<button onClick={()=>this.setState({count:1})}>Click Me </button>
</div>
)
}
}
export default App;
Comments
Post a Comment