我尝试在VS代码中创建React
项目。当我尝试使用如下的HTML标签保存index.js
时,VS代码会打破我的标签,并在单词和括号之间推空。找不到我如何修复它……
// this is before I safe the project
ReactDOM.render( <div> Hello World! </div>, document.getElementById('root'))
// this is after I safe the project
ReactDOM.render( < div > Hello World! < /div>, document.getElementById('root'))
要么:
- 将所有
.js
文件扩展名更改为.jsx
。 - 在用户/工作区设置中添加文件关联:
"files.associations": {
"*.js": "javascriptreact"
}