Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my favorite js snippets
{
"Object Destructure from this.props": {
"prefix": "odprops",
"body": [
"const { ${1:value} } = this.props;"
],
"description": ""
},
"Re-export": {
"prefix": "rexp",
"body": [
"export { default as ${1:MyComponent} } from './${1:MyComponent}';"
],
"description": ""
},
"Re-export as default": {
"prefix": "rexpd",
"body": [
"export { default } from './${1:MyComponent}';"
],
"description": ""
},
"ftrsc": {
"prefix": "ftrsc",
"body": [
"// @flow",
"import React from 'react';",
"",
"type Props = {",
"};",
"",
"const ${TM_FILENAME_BASE} = (props: Props) => {",
" return (",
" <div>",
" ${TM_FILENAME_BASE}",
" </div>",
" );",
"};",
"",
"export default ${TM_FILENAME_BASE};"
],
"description": "Flow typed Stateless Component"
},
"ftrcc": {
"body": [
"// @flowtype",
"import React, { Component } from 'react';",
"",
"type Props = {};",
"class ${TM_FILENAME_BASE} extends Component<Props> {",
" render() {",
" return <div />;",
" }",
"}",
"",
"export default ${TM_FILENAME_BASE};",
""
]
},
"Flowtyped React Class Component": {
"prefix": "ftrcc",
"body": [
"// @flow",
"import React, { Component } from 'react';",
"",
"type Props = {};",
"class ${TM_FILENAME_BASE} extends Component<Props> {",
" render() {",
" return <div />;",
" }",
"}",
"",
"export default ${TM_FILENAME_BASE};",
""
],
"description": ""
},
"import connect from react-redux": {
"prefix": "imprrc",
"body": [
"import { connect } from 'react-redux';"
],
"description": ""
},
"import flowtype State from store": {
"prefix": "ftimpstate",
"body": [
"import type { State } from 'store';"
],
"description": ""
},
"connect flowtyped container": {
"prefix": "ftconnect",
"body": [
"export default connect(",
" (state: State) => ({}),",
" () => ({}),",
")(${TM_FILENAME_BASE});",
""
],
"description": ""
},
"Create Icon Component": {
"prefix": "rcicon",
"body": [
"import React from 'react';",
"import Icon from 'react-icon-base';",
"",
"const ${TM_FILENAME_BASE} = props => (",
" <Icon viewBox=\"0 0 16 16\" {...props}>",
" ${1}",
" </Icon>",
");",
"",
"export default ${TM_FILENAME_BASE};",
""
],
"description": "n"
},
"Create Flowtyped React Class Container Component": {
"prefix": "ftrctn",
"body": [
"// @flow",
"import React, { Component } from 'react';",
"import * as actions from 'store/actionCreators';",
"import type { State } from 'store';",
"import { connect } from 'react-redux';",
"",
"type Props = {};",
"",
"class ${TM_FILENAME_BASE} extends Component<Props> {",
" render() {",
" return null;",
" }",
"}",
"",
"export default connect((state: State) => ({}), () => ({}))(${TM_FILENAME_BASE});",
""
],
"description": ""
},
"Flowtyped Router Controller": {
"prefix": "ftctrl",
"body": [
"// @flow",
"import type { Middleware, Context } from 'koa';",
"",
"export const sampleRoute: Middleware = async (ctx) => {};",
""
],
"description": ""
},
"import react native": {
"prefix": "imprn",
"body": [
"import { Text, View } from 'react-native';"
],
"description": ""
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.