vscod:

  点击左下角设置==>用户代码片段==>搜索创建react.json==>贴入代码

{ 
    "Print to console": {
        "scope": "javascript,typescript",
        "prefix": "react",
        "body": [ 
            "import React, { Component } from 'react'",
            "class  extends Component {",
                "constructor(props) {",
                    "super(props);",
                    "this.state = {}",
                "}",
                "render() {",
                    "return ();",
                "}",
            "}", 
            "export default ;"
        ],
        "description": "Log output to console"
    }
}

如图

vscode和webstrom中react模板,用户代码片段

 

 vscode和webstrom中react模板,用户代码片段

 

 

新建js后输入react按下Tab键即可

完成

 

webstrome模板

任意文件夹中点击右键,选择新建==>编辑文件模板==>点击+号添加贴入代码

import React, { Component } from 'react'
class #[[$default$]]# extends Component {
    constructor(props) {
        super(props);
        this.state = {  }
    }
    render() { 
        return (<div></div>);
    }
}
 
export default #[[$default$]]#;

如图:

vscode和webstrom中react模板,用户代码片段

 

 vscode和webstrom中react模板,用户代码片段

 

 

点击新建就会多出一个叫react的js文件,新建即可

完成

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2021-08-15
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案