vscode用react写代码过程中,明明格式没写错,但不知为何在保存后提示出错并自动生成了许多空格,如下两图所示,请问如何解决:
保存前:
保存后:
把相关插件禁用掉,自动格式化配置等扩展都是得符合react风格的,
import React, { Component } from 'react';
class Footer extends Component {
constructor(props){
super(props)
this.state={
msg:"footer组件数据"
}
}
render() {
return (
<div>
<h3>{this.state.msg}</h3>
</div>
);
}
}
export default Footer;
问题终于解决了!只要把自动格式化的插件删除即可