Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "typeScriptReactClassComponent": {
- "prefix": "tsrcc",
- "body": [
- "import React, { Component } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "interface State {",
- "\t",
- "}",
- "",
- "export default class ${1:${TM_FILENAME_BASE}} extends Component<Props, State> {",
- "\tstate = {}",
- "",
- "\trender() {",
- "\t\treturn (",
- "\t\t\t<div>",
- "\t\t\t\t$0",
- "\t\t\t</div>",
- "\t\t)",
- "\t}",
- "}",
- ""
- ],
- "description": "Creates a React component class with ES7 module system and TypeScript interfaces"
- },
- "typeScriptReactClassExportComponent": {
- "prefix": "tsrce",
- "body": [
- "import React, { Component } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "interface State {",
- "\t",
- "}",
- "",
- "class ${1:${TM_FILENAME_BASE}} extends Component<Props, State> {",
- "\tstate = {}",
- "",
- "\trender() {",
- "\t\treturn (",
- "\t\t\t<div>",
- "\t\t\t\t$0",
- "\t\t\t</div>",
- "\t\t)",
- "\t}",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- ""
- ],
- "description": "Creates a React component class with ES7 module system and TypeScript interfaces"
- },
- "typeScriptReactFunctionalExportComponent": {
- "prefix": "tsrfce",
- "body": [
- "import React, { ReactElement } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "function ${1:${TM_FILENAME_BASE}}({}: Props): ReactElement {",
- "\treturn (",
- "\t\t<div>",
- "\t\t\t$0",
- "\t\t</div>",
- "\t)",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- ""
- ],
- "description": "Creates a React Functional Component with ES7 module system and TypeScript interface"
- },
- "typeScriptReactFunctionalComponent": {
- "prefix": "tsrfc",
- "body": [
- "import React, { ReactElement } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "export default function ${1:${TM_FILENAME_BASE}}({}: Props): ReactElement {",
- "\treturn (",
- "\t\t<div>",
- "\t\t\t$0",
- "\t\t</div>",
- "\t)",
- "}",
- ""
- ],
- "description": "Creates a React Functional Component with ES7 module system and TypeScript interface"
- },
- "typeScriptReactArrowFunctionExportComponent": {
- "prefix": "tsrafce",
- "body": [
- "import React from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "const ${1:${TM_FILENAME_BASE}} = (props: Props) => {",
- "\treturn (",
- "\t\t<div>",
- "\t\t\t$0",
- "\t\t</div>",
- "\t)",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- ""
- ],
- "description": "Creates a React Arrow Function Component with ES7 module system and TypeScript interface"
- },
- "typeScriptReactArrowFunctionComponent": {
- "prefix": "tsrafc",
- "body": [
- "import React from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "export const ${1:${TM_FILENAME_BASE}} = (props: Props) => {",
- "\treturn (",
- "\t\t<div>",
- "\t\t\t$0",
- "\t\t</div>",
- "\t)",
- "}",
- ""
- ],
- "description": "Creates a React Arrow Function Component with ES7 module system and TypeScript interface"
- },
- "typeScriptReactClassPureComponent": {
- "prefix": "tsrpc",
- "body": [
- "import React, { PureComponent } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "export default class ${1:${TM_FILENAME_BASE}} extends PureComponent<Props> {",
- "\trender() {",
- "\t\treturn (",
- "\t\t\t<div>",
- "\t\t\t\t$0",
- "\t\t\t</div>",
- "\t\t)",
- "\t}",
- "}",
- ""
- ],
- "description": "Creates a React pure component class with ES7 module system and TypeScript interface"
- },
- "typeScriptReactClassExportPureComponent": {
- "prefix": "tsrpce",
- "body": [
- "import React, { PureComponent } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "class ${1:${TM_FILENAME_BASE}} extends PureComponent<Props> {",
- "\trender() {",
- "\t\treturn (",
- "\t\t\t<div>",
- "\t\t\t\t$0",
- "\t\t\t</div>",
- "\t\t)",
- "\t}",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- ""
- ],
- "description": "Creates a React pure component class with ES7 module system and TypeScript interface"
- },
- "typeScriptReactFunctionMemoComponent": {
- "prefix": "tsrmc",
- "body": [
- "import React, { memo } from 'react'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "export default memo(function ${1:${TM_FILENAME_BASE}}({}: Props) {",
- "\treturn (",
- "\t\t<div>",
- "\t\t\t$0",
- "\t\t</div>",
- "\t)",
- "})",
- ""
- ],
- "description": "Creates a React Memo Function Component with ES7 module system and TypeScript interface"
- },
- "typeScriptReactClassCompomentRedux": {
- "prefix": "tsrcredux",
- "body": [
- "import React, { Component } from 'react'",
- "import { connect } from 'react-redux'",
- "",
- "interface Props {",
- "\t",
- "}",
- "interface State {",
- "\t",
- "}",
- "",
- "export class ${1:${TM_FILENAME_BASE}} extends Component<Props, State> {",
- "\tstate = {}",
- "",
- "\trender() {",
- "\t\treturn (",
- "\t\t\t<div>",
- "\t\t\t\t$0",
- "\t\t\t</div>",
- "\t\t)",
- "\t}",
- "}",
- "",
- "const mapStateToProps = (state) => ({",
- "\t",
- "})",
- "",
- "const mapDispatchToProps = {",
- "\t",
- "}",
- "",
- "export default connect(mapStateToProps, mapDispatchToProps)(${1:${TM_FILENAME_BASE}})",
- ""
- ],
- "description": "Creates a React component class with PropTypes with connected redux and ES7 module system and TypeScript interfaces"
- },
- "typescriptReactNativeArrowFunctionComponent": {
- "prefix": "tsrnf",
- "body": [
- "import React from 'react'",
- "import { View, Text } from 'react-native'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "const ${1:${TM_FILENAME_BASE}} = (props: Props) => {",
- "\treturn (",
- "\t\t<View>",
- "\t\t\t<Text>$0</Text>",
- "\t\t</View>",
- "\t)",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- ""
- ],
- "description": "Creates a React Native Arrow Function Component with ES7 module system and TypeScript interface"
- },
- "typescriptReactNativeArrowFunctionComponentNamedProps": {
- "prefix": "tsrnfi",
- "body": [
- "import React from 'react'",
- "import { View } from 'react-native'",
- "",
- "interface ${1:${TM_FILENAME_BASE}}Props {",
- "\t",
- "}",
- "",
- "const ${1:${TM_FILENAME_BASE}}: React.FunctionComponent<${1:${TM_FILENAME_BASE}}Props> = (props) => {",
- "\treturn (",
- "\t\t<View>",
- "\t\t\t$0",
- "\t\t</View>",
- "\t)",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- ""
- ],
- "description": "Creates a React Native Arrow Function Component with ES7 module system and named TypeScript interface"
- },
- "typescriptReactNativeArrowFunctionComponentWithStyles": {
- "prefix": "tsrnfs",
- "body": [
- "import React from 'react'",
- "import { StyleSheet, Text, View } from 'react-native'",
- "",
- "interface Props {",
- "\t",
- "}",
- "",
- "const ${1:${TM_FILENAME_BASE}} = (props: Props) => {",
- "\treturn (",
- "\t\t<View>",
- "\t\t\t<Text>$0</Text>",
- "\t\t</View>",
- "\t)",
- "}",
- "",
- "export default ${1:${TM_FILENAME_BASE}}",
- "",
- "const styles = StyleSheet.create({})",
- ""
- ],
- "description": "Creates a React Native Arrow Function Component with ES7 module system, TypeScript interface and StyleSheet"
- },
- "Export interface": {
- "prefix": "expint",
- "body": ["export interface ${1:${TM_FILENAME_BASE}} {$0}"]
- },
- "Export type": {
- "prefix": "exptp",
- "body": ["export type ${1:${TM_FILENAME_BASE}} = {$0}"]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement