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" } }
如圖


新建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$]]#;
如圖:


點擊新建就會多出一個叫react的js文件,新建即可
完成
