JavaScript 结束标记



我注意到大多数时候我用JavaScript编写HTML,结束标签"/>"使文件中的其余代码无法正确识别,例如注释不被视为注释

beforeEach(() => {
    wrapper = shallow(
      <FilterableProductTable 
        products={products}/>
    )
  });
  // Checking the intitial state
  it('should initialize the filterText state to an empty string', () => {
    expect(wrapper).to.have.state('filterText').to.equal('');
  });

但是如果我将"/>"设置为">",则注释有效。有人可以帮助解释这一点以及如何解决这个问题吗?

这是一个反应代码。但这也发生在 HTML 和 wp 脚本上。

这在Sublime编辑器中通过安装Babel软件包解决了:

"cmd + shift + p"> "包控制:安装包"> 巴别塔

现在通过以下方式启用语法:查看> 语法> Babel> Javascript(Babel)

最新更新