Created
January 24, 2018 13:05
-
-
Save kirill578/e0fb9a451ca00eaf5b0bb8435b9c91a9 to your computer and use it in GitHub Desktop.
This file contains 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 characters
import React from 'react'; | |
import { Component } from 'react'; | |
import { render } from 'react-dom'; | |
import { withState, compose, lifecycle } from 'recompose' | |
const Enhanced = compose( | |
withState('text', 'setText', 'first'), | |
lifecycle({ | |
componentDidMount() { | |
var that = this; | |
setTimeout(() => { | |
that.props.setText('second'); | |
}, 1000); | |
}, | |
})) | |
( ({ text }) => { | |
return ( | |
<div>{text}</div> | |
); | |
}); | |
const App = () => ( | |
<Enhanced text="text" /> | |
); | |
render(<App />, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment