search

Home  >  Q&A  >  body text

javascript - How to write comments in react? {/**/}This doesn’t work~

The final effect I want is this

When I wrote it, it was compiled into react-text. What is this? Logically speaking, shouldn't it be displayed as <!-- hfkdshk -->?

習慣沉默習慣沉默2754 days ago473

reply all(3)I'll reply

  • 阿神

    阿神2017-05-19 10:46:34

    jsx is syntax sugar for js, that is, jsx is also js.
    So the comment syntax of jsx is not <!-- -->
    Same question /q/10...

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-19 10:46:34

    This is JSX.

    Don’t write comments inside.

    reply
    0
  • 黄舟

    黄舟2017-05-19 10:46:34

    {/* jsx */} 单行注释
    
    {/*
        多行注释   
    */}

    reply
    0
  • Cancelreply