Skip to content

Instantly share code, notes, and snippets.

@arinthros
Last active July 9, 2020 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arinthros/438817f16ce2f016c94604aedfa030ff to your computer and use it in GitHub Desktop.
Save arinthros/438817f16ce2f016c94604aedfa030ff to your computer and use it in GitHub Desktop.
Custom React snippets for VSCode
// Place in the snippets folder of vscode
{
// shortcode: impc
// Creates an empty React function component with a common set of items, like imports and proptypes
// Tab stop 1 is the function name
// Tab stop 2 is for props
"Create empty component": {
"scope": "javascript",
"prefix": "impc",
"body": [
"import React from 'react'",
"import PropTypes from 'prop-types'",
"",
"export function $1({$2}) {",
"",
" return (",
" <>",
" $0",
" </>",
" )",
"}",
"",
"$1.propTypes = {",
" $2",
"}",
"",
"$1.defaultProps = {",
" $2",
"}",
"",
],
"description": "Creates empty component"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment