Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
Fix lifecycle to support React 15.5 (#346)
Browse files Browse the repository at this point in the history
* Fix lifecycle to support React 15.5

* bind is not neeed

* Object.assign instead of Object.keys
  • Loading branch information
istarkov committed Apr 8, 2017
1 parent 47d4ec7 commit 493851e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/packages/recompose/lifecycle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createClass } from 'react'
import { Component } from 'react'
import createHelper from './createHelper'
import createEagerFactory from './createEagerFactory'

Expand All @@ -15,17 +15,20 @@ const lifecycle = spec => BaseComponent => {
)
}

/* eslint-disable react/prefer-es6-class */
return createClass({
...spec,
return class extends Component {
constructor(...args) {
super(...args)

Object.assign(this, spec)
}

render() {
return factory({
...this.props,
...this.state
})
}
})
/* eslint-enable react/prefer-es6-class */
}
}

export default createHelper(lifecycle, 'lifecycle')

0 comments on commit 493851e

Please sign in to comment.