Redux component templates in ES6
// ES6, Redux, Template, Stateless, React, JS
import React,{PropTypes} from "react";
const YOUR_CLASS_NAME = (/*props*/) => {
return(
);
};
YOUR_CLASS_NAME.propTypes = {
//name: React.PropTypes.string.isRequired
};
export default YOUR_CLASS_NAME;
//JS, ES6, React, Redux, Template
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
class YOUR_CLASS_NAME extends React.Component {
constructor(props, context) {
super(props, context);
}
render() {
return (
);
}
}
YOUR_CLASS_NAME.propTypes = {
//myProp: PropTypes.string.isRequired
};
function mapStateToProps(state, ownProps){
return {
state: state
};
}
function mapDispatchToProps(dispatch){
return {
actions: bindActionCreators(actions, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(YOUR_CLASS_NAME);