"hooks-comp": {
"scope": "javascript, typescript, javascriptreact, typescriptreact",
"prefix": "hooks-comp",
"body": [
"import React, { useEffect } from 'react';",
"import { withRouter, RouteComponentProps } from 'react-router-dom';",
"import { observer } from 'mobx-react';\n",
"interface IProps extends RouteComponentProps {",
"\thistory: any,",
"}",
"interface IState {}\n",
"const $1 = (props: IProps, state: IState) => {\n",
"\tuseEffect(() => {",
"\t\tconsole.log('enter $1...');\n",
"\t\treturn () => {",
"\t\t\tconsole.log('leave $1...');",
"\t\t};",
"\t});\n",
"\treturn (",
"\t\t<div>",
"\t\t\t<p>*** $1 ***</p>",
"\t\t</div>",
"\t);",
"};\n",
"export default withRouter(observer($1));\n",
],
"description": "Basic React-Hooks component.",
},
网友评论