main
Last change
on this file since d565449 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
|
Rev | Line | |
---|
[d565449] | 1 | import * as React from 'react';
|
---|
| 2 |
|
---|
| 3 | const 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 |
|
---|
| 17 | export default wrapInStatefulComponent;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.