Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions snippets/JavaScript (JSX).cson
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
prefix: "imr"
body: "import React from 'react';"

"React: import component with lazy load":
prefix: "imlazy"
body: "const $1 = React.lazy(() => import('${1}'));"

"React: componentDidMount: fn() { ... }":
prefix: "cdm"
body: "componentDidMount: function() {\n\t${1}\n},"
Expand All @@ -16,6 +20,10 @@
prefix: "cdup"
body: "componentDidUpdate: function(prevProps, prevState) {\n\t${1}\n},"

"React: componentDidCatch: fn(error, info) { ... }":
prefix: "cdc"
body: "componentDidCatch: function(error, info) {\n\t${1}\n},"

"React: componentWillMount: fn() { ... }":
prefix: "cwm"
body: "componentWillMount: function() {\n\t${1}\n},"
Expand Down Expand Up @@ -92,6 +100,10 @@
prefix: "cdup6"
body: "componentDidUpdate(prevProps, prevState) {\n\t${1}\n}"

"React: componentDidCatch(error, info) { ... } (ES6)":
prefix: "cdc6"
body: "componentDidCatch(error, info) {\n\t${1}\n}"

"React: componentWillMount() { ... } (ES6)":
prefix: "cwm6"
body: "componentWillMount() {\n\t${1}\n}"
Expand Down Expand Up @@ -132,6 +144,10 @@
prefix: "rcs"
body: "import React from \'react\'\nimport PropTypes from \'prop-types\'\n\nconst $1 = (${2:props}) => {\n\treturn (\n\t\t${3:<div />}\n\t)\n}\n\nexport default ${1}\n"

"React: error boundary skeleton (ES6)":
prefix: 'reb6'
body: "import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass $1 extends React.Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n return { hasError: true };\n }\n\n componentDidCatch(error, info) {\n // You can also log the error to an error reporting service\n }\n\n render() {\n if (this.state.hasError) {\n // You can render any custom fallback UI\n return <h1>Something went wrong.</h1>;\n }\n\n return this.props.children; \n }\n}\n\nexport default ${1};"

"React: render() { return ... } (ES6)":
prefix: "ren6"
body: "render() {\n\treturn (\n\t\t${1:<div />}\n\t);\n}"
Expand Down