Skip to content

Instantly share code, notes, and snippets.

@kirill578
Created January 24, 2018 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirill578/e0fb9a451ca00eaf5b0bb8435b9c91a9 to your computer and use it in GitHub Desktop.
Save kirill578/e0fb9a451ca00eaf5b0bb8435b9c91a9 to your computer and use it in GitHub Desktop.
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