Last active
October 18, 2017 12:27
-
-
Save EhsanZ/a8fe49f3f366eee30526c9bc33e0fff5 to your computer and use it in GitHub Desktop.
React / Redux File Templates For JetBrain IDEs
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
import React, {PropTypes} from 'react' | |
class $NAME extends React.Component { | |
render() { | |
return(<h1> $NAME </h1>) | |
} | |
} | |
$NAME .PropTypes = { | |
// myProp: PropTypes.string.isRequired | |
} | |
export default $NAME |
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
import React, { Component } from 'react' | |
import { connect } from 'react-redux' | |
import { withRouter } from 'react-router-dom' | |
import { bindActionCreators } from 'redux' | |
// import * as actions from 'file.actions' | |
class $NAME extends Component { | |
render() { | |
return (<h1> $NAME </h1>) | |
} | |
componentDidMount(){ | |
// this.props.actions.fetch() | |
} | |
} | |
const mapStateToProps = (state) => { | |
return { | |
state: state | |
} | |
} | |
const mapDispatchToProps = (dispatch) => { | |
return { | |
// actions: bindActionCreators(actions, dispatch) | |
}; | |
} | |
const container = connect(mapStateToProps, mapDispatchToProps)($NAME) | |
export default withRouter(container) |
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
import React, { PropTypes } from 'react' | |
import { generateReactKey } from 'utils/utils' | |
const $NAME = ({props}) => { | |
return (<h1 key={generateReactKey()}> $NAME </h1>) | |
} | |
$NAME .PropTypes = { | |
// props: PropTypes.string.isRequired | |
} | |
export default $NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment