Skip to content

Instantly share code, notes, and snippets.

@cynx
Created February 18, 2017 18:03
Show Gist options
  • Save cynx/a9dee634cb24fb260440a14ad983dd01 to your computer and use it in GitHub Desktop.
Save cynx/a9dee634cb24fb260440a14ad983dd01 to your computer and use it in GitHub Desktop.
React / Redux Templates for WebStorm
import React, {Component, PropTypes} from 'react';
class $NAME extends Component {
constructor(props, context){
super(props, context);
}
render(){
return (
<div>
</div>
);
}
}
$NAME .propTypes = {
//myProp: PropTypes.object.isRequired
};
$NAME .defaultProps = {
//myProp: <defaultValue>
};
export default $NAME;
import React, {PropTypes} from 'react';
const $NAME = (props) => {
return (
<div>
</div>
);
};
$NAME .propTypes = {
//myProp: PropTypes.object.isRequired
};
$NAME .defaultProps = {
//myProp: <defaultValue>
};
export default $NAME;
import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
class $NAME extends Component {
constructor(props, context){
super(props, context);
}
render(){
return (
<div>
</div>
);
}
}
$NAME .propTypes = {
//myProp: PropTypes.object.isRequired
};
$NAME .defaultProps = {
//myProp: <defaultValue>
};
function mapStateToProps(state, ownProps){
return {
state: state
};
}
function mapDispatchToProps(dispatch){
return {
actions: bindActionCreators(actions, dispatch)
};
}
export default connect(mapStateToProps,mapDispatchToProps)($NAME);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment