Last active
April 14, 2017 14:59
-
-
Save tecsyscom/44165a6c0f1726ecebf2fff05803ac1e to your computer and use it in GitHub Desktop.
no ES6
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'; | |
var SomeMixin = { | |
doSomething() { | |
} | |
}; | |
const App = React.createClass({ | |
getInitialState: function() { | |
return {count: this.props.initialCount}; | |
}, | |
propTypes: { | |
}, | |
getDefaultProps() { | |
return { | |
name: 'Mary' | |
}; | |
}, | |
mixins: [SomeMixin], | |
handleClick() { | |
this.doSomething(); // use mixin | |
}, | |
render() { | |
return ( | |
<div onClick={this.handleClick}></div> | |
); | |
} | |
}); | |
function mapStateToProps(state) { | |
console.log(state); | |
return { | |
todos: state.todos | |
}; | |
} | |
function mapDispatchToProps(dispatch) { | |
return { | |
actions: bindActionCreators(TodoActions, dispatch) | |
}; | |
} | |
export default connect( | |
mapStateToProps, | |
mapDispatchToProps | |
)(App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReactDOM.render(
element,
document.getElementById('root')
);