Created
October 31, 2018 09:08
-
-
Save danakt/c421a262a68e9de988c75ab8a3d1ad44 to your computer and use it in GitHub Desktop.
Revisions
-
danakt created this gist
Oct 31, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ /** * Wraps any React component (even functional) to PureComponent class */ export const pureComponent = function<P>(Component: React.ComponentType<P>) { return class extends React.PureComponent<P> { static displayName = `pureComponent(${Component.displayName || Component.name})`; render() { return <Component {...this.props} />; } }; };