简体   繁体   中英

JavaScript closing tags

I have noticed most of the time I write HTML with JavaScript the closing tags "/>" makes the rest of the code in the file, is not identified properly, for eg comments are not taken as comments

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('');
  });

But if I make "/>" to ">", the comment works. Can someone help in explaining this and how to sort this issue?

This is a react code. But this also happened for HTML and wp scripts

This was solved in the Sublime editor by installing the Babel package:

"cmd + shift + p" > "Package Control: Install Package" > Babel

Now enable the syntax by: View > Syntax > Babel > Javascript(Babel)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM