Reputation: 69
How to make pure component using in functional react component ?
const MyComponent = () => {
return (<h1>I am functional component.</h1>)
}
export default MyComponent;
How to make a pure component out of the above code ?
Upvotes: 1
Views: 1114
Reputation: 159
you can use React.memo
import React from 'react';
const MyComponent = () => {
return (<h1>I am functional component.</h1>)
}
export default React.memo(MyComponent);
Upvotes: 1