Skip to content

Instantly share code, notes, and snippets.

@StrongerMyself
Created February 25, 2019 09:32
Show Gist options
  • Save StrongerMyself/f89d6b461507c5626c6ad05de9245ad3 to your computer and use it in GitHub Desktop.
Save StrongerMyself/f89d6b461507c5626c6ad05de9245ad3 to your computer and use it in GitHub Desktop.
vs-code jsx snippets
{
"jsx-component": {
"prefix": "jsx-component",
"body": [
"import React, { Component } from 'react'",
"import PropTypes from 'prop-types'",
"",
"import c from './${2:style}.style.sass'",
"",
"export default class ${1:component} extends Component {",
"",
" static propTypes = {",
" name: PropTypes.string,",
" }",
"",
" static defaultProps = {",
" name: '-',",
" }",
"",
" render() {",
" let { name } = this.props",
" return (",
" <div className={c.${3:class}}>",
" {name}",
" </div>",
" )",
" }",
"}",
],
"description": "React template component"
},
"React import BrowserRouter libs": {
"prefix": "react-router-lib",
"body": [
"import { ${1:BrowserRouter as }${2:Router, }${3:Route, }${4:Link, }${5:NavLink} } from 'react-router-dom'$0"
],
"description": "React import BrowserRouter libs"
},
"React styled init": {
"prefix": "react-styled",
"body": [
"import styled from 'styled-components'",
"// import { Link } from 'react-router-dom'",
"",
"export const ",
" ${1:Elem} = styled.div`",
" $2",
" `${3:,}",
" $0",
],
"description": "React import BrowserRouter libs"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment