Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.8 kB
1
Indexable
Never
{
  "Empty component": {
    "prefix": "comp",
    "body": [
      "import React, { PureComponent as Component } from 'react';",
      "import PropTypes from 'prop-types';",
      "",
      "import styles from './${1:NewComponent}.less';",
      "",
      "const propTypes = {};",
      "",
      "const defaultProps = {};",
      "",
      "class ${1:NewComponent} extends Component {",
      "\tconstructor(props) {",
      "\t\tsuper(props);",
      "\t}",
      "",
      "\trender() {",
      "\t\treturn <div></div>;",
      "\t}",
      "}",
      "",
      "${1:NewComponent}.propTypes = propTypes;",
      "",
      "${1:NewComponent}.defaultProps = defaultProps;",
      "",
      "export default ${1:NewComponent};",
      ""
    ],
    "description": ""
  },
  "Index file": {
    "prefix": "index",
    "body": [
      "import ${1:Component} from './${1:Component}';",
      "",
      "export default ${1:Component};",
      ""
    ],
    "description": ""
  },
  "Lifecycle": {
    "prefix": "life",
    "body": [
      "componentDidMount() {",
      "      ",
      "}",
      "",
      "componentDidUpdate(prevProps) {",
      "    ",
      "}",
      "",
      "componentWillUnmount() {",
      "  ",
      "}"
    ],
    "description": " "
  },
  "RemoteRequest": {
    "prefix": "remote",
    "body": [
      "remoteRequest({",
      "\turl: 'actions/echo',",
      "\tdata: {",
      "\t\taction: 'view',",
      "\t\tid: 1,",
      "\t},",
      "\tonSuccess: (response) => {",
      "\t\tconsole.log(response);",
      "\t},",
      "\tonError: (response) => {",
      "\t\tshowAlert({ content: response.msg });",
      "\t},",
      "});",
      ""
    ],
    "description": ""
  },
  "ClassName": {
    "prefix": "_g.class",
    "body": [
      "const className = _g.classNames(",
      "\tstyles['wrapper'],",
      "\t{ [styles['loading']]: loading },",
      "\t{ [styles['disabled']]: disabled },",
      ");"
    ],
    "description": ""
  },
  "Classn": {
    "prefix": "classN",
    "body": [
      "className={styles.${1:wrapper}}",
    ],
    "description": ""
  },
  "Classn": {
    "prefix": "classN",
    "body": [
      "className=''",
    ],
    "description": ""
  },
  "New rend": {
    "prefix": "rend",
    "body": [
      "${1:MethodName} = () => {",
      "    return (",
      "      <div></div>",
      "    );",
      "  };"
    ],
    "description": ""
  },
  "New component with ui": {
    "prefix": "compui",
    "body": [
      "import React, { PureComponent as Component } from 'react';",
      "import PropTypes from 'prop-types';",
      "",
      "import WithUi from 'hoc/store/ui'",
      "",
      "const propTypes = {",
      "",
      "};",
      "",
      "const defaultProps = {",
      "",
      "};",
      "",
      "const uiProps = (ownProps) => {",
      "",
      "  return {",
      "    ",
      "  }",
      "};",
      "",
      "class ${1:NewComponent} extends Component {",
      "",
      "  constructor(props) {",
      "    super(props);",
      "",
      "  }",
      "",
      "  render() {",
      "",
      "    return (",
      "      <div>",
      "",
      "      </div>",
      "    );",
      "",
      "  }",
      "}",
      "",
      "${1:NewComponent}.propTypes = propTypes;",
      "",
      "${1:NewComponent}.defaultProps = defaultProps;",
      "",
      "export default WithUi(uiProps)(${1:NewComponent});"
    ],
    "description": ""
  },
  "Arrow function": {
    "prefix": "af",
    "body": [
      "(${1:}) => {",
      "\t",
      "}"
    ],
    "description": ""
  },
  "Hook": {
    "prefix": "hook",
    "body": [
      "export default function ${1:Hook} () {",
      "    return (",
      "      <div></div>",
      "    );",
      "  };"
    ],
    "description": ""
  }
}
Leave a Comment