Created
June 20, 2019 20:44
-
-
Save benhorst/c020c5cce74ebb5d964b689563c38a5c to your computer and use it in GitHub Desktop.
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 & redux snippets for vscode | |
"react_component": { | |
"prefix": "comp", | |
"body": [ | |
"import React from 'react';", | |
"import PropTypes from 'prop-types';", | |
"", | |
"const ${1:ComponentName} = ({}) => (", | |
"\t<div>", | |
"\t\t$0", | |
"\t</div>", | |
");", | |
"" | |
], | |
"description": "pls why" | |
}, | |
"react_stateful": { | |
"prefix": "comp state", | |
"body": [ | |
"import React, { useState } from 'react';", | |
"import PropTypes from 'prop-types';", | |
"", | |
"const ${1:ComponentName} = ({}) => {", | |
"\tconst [${2:stateName}, set${2:stateName}] = useState(${3:initialState});", | |
"\treturn (", | |
"\t\t<div>", | |
"\t\t\t$0", | |
"\t\t</div>", | |
"\t);", | |
"};", | |
"" | |
] | |
}, | |
"react_redux": { | |
"prefix": "comp redux", | |
"body": [ | |
"import React, { useState } from 'react';", | |
"import PropTypes from 'prop-types';", | |
"import { connect } from 'react-redux';", | |
"", | |
"const ${1:ComponentName} = ({}) => {", | |
"\tconst [${2:stateName}, set${2:stateName}] = useState(${3:initialState});", | |
"\treturn (", | |
"\t\t<div>", | |
"\t\t\t$0", | |
"\t\t</div>", | |
"\t);", | |
"};", | |
"", | |
"const mapState = () => ({", | |
"\t", | |
"});", | |
"const mapDispatch = {", | |
"\t", | |
"}", | |
"export const Connected${1ComponentName} = connect(", | |
"\tmapState,", | |
"\tmapDispatch,", | |
")($1);", | |
"" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment