Created
July 20, 2015 05:42
-
-
Save hufeng/b5a4ac3138191e3fc981 to your computer and use it in GitHub Desktop.
iflux es6
This file contains hidden or 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
/** | |
* React支持es6的class语法,但是在class中并没有一个很好的概念来对应mixin | |
* | |
* 我们也要考虑弱化mixin | |
* | |
* 那怎么做呢?使用高阶函数来解决这个问题 | |
* | |
* 但是有个难点还会是需要再想想,怎么把store的更新和react的render结合起来,做到透明 | |
* 比如 | |
*/ | |
import React from 'react'; | |
import appStore from './store'; | |
/** | |
* high functional | |
*/ | |
let App = appStore.createContainer(class App extends React.Component { | |
render() { | |
return ( | |
<ul> | |
<li>username: { this.props.username }</li> | |
<li>email: { this.prpps.email }</li> | |
</ul> | |
); | |
} | |
}); | |
React.render(<App/>, document.body); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment