Skip to content

Instantly share code, notes, and snippets.

@tecsyscom
Last active April 14, 2017 14:59
Show Gist options
  • Save tecsyscom/44165a6c0f1726ecebf2fff05803ac1e to your computer and use it in GitHub Desktop.
Save tecsyscom/44165a6c0f1726ecebf2fff05803ac1e to your computer and use it in GitHub Desktop.
no ES6
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);
@tecsyscom
Copy link
Author

ReactDOM.render(
element,
document.getElementById('root')
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment