Created
August 30, 2017 22:22
-
-
Save kirkbyers/337dc6ac6cd241c8a6ef0af0960bed2c to your computer and use it in GitHub Desktop.
A tsx snippet to quickly scaffold out redux containers
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
| "React Container": { | |
| "prefix": "rx-container", | |
| "body": [ | |
| "import * as React from 'react';", | |
| "import { Dispatch, connect } from 'react-redux';", | |
| "", | |
| "import { State } from '../reducers';", | |
| "", | |
| "interface Props { }", | |
| "interface StateProps { }", | |
| "interface DispatchProps { }", | |
| "type ComponentProps = Props & StateProps & DispatchProps;", | |
| "", | |
| "interface ComponentState { }", | |
| "", | |
| "class ${1:ComponentName} extends React.Component<ComponentProps, ComponentState> {", | |
| "\trender() {", | |
| "\t\treturn (<div />);", | |
| "\t}", | |
| "}", | |
| "", | |
| "const mapStateToProps = (state: State): StateProps => ({});", | |
| "const mapDispatchToProps = (dispatch: Dispatch<State>): DispatchProps => ({});", | |
| "export default connect<StateProps, DispatchProps, Props>", | |
| " (mapStateToProps, mapDispatchToProps)(${1:ComponentName});" | |
| ], | |
| "description": "Scafolding for a container component" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment