source: imaps-frontend/node_modules/react-universal-interface/src/wrapInStatefulComponent.ts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 440 bytes
Line 
1import * as React from 'react';
2
3const wrapInStatefulComponent = (Comp) => {
4 const Decorated = class extends React.Component<any, any> {
5 render () {
6 return Comp(this.props, this.context);
7 }
8 };
9
10 if (process.env.NODE_ENV !== 'production') {
11 (Decorated as any).displayName = `Decorated(${Comp.displayName || Comp.name})`;
12 }
13
14 return Decorated;
15};
16
17export default wrapInStatefulComponent;
Note: See TracBrowser for help on using the repository browser.