[英]VS Code how to combine HTML into .JS file?
I try to create a React
project in VS Code. 我尝试在VS Code中创建一个
React
项目。 When I try to save index.js
with the HTML tags as below, VS Code breaks my tags and pushes spaces between words and brackets. 当我尝试使用以下HTML标记保存
index.js
时,VS Code破坏了我的标记并在单词和方括号之间添加了空格。 Can't find how I can fix it… 找不到解决方法...
// 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'))
Either: 或者:
.js
file extensions to .jsx
. .js
文件扩展名更改为.jsx
。 "files.associations": {
"*.js": "javascriptreact"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.