[英]How to make pure components in react js using functional approach i.e. non class based
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?如何用上面的代码制作一个纯组件?
you can use React.memo你可以使用 React.memo
import React from 'react';
const MyComponent = () => {
return (<h1>I am functional component.</h1>)
}
export default React.memo(MyComponent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.