How to comment JSX code out in .js files in VSCode?

前端 未结 16 782
天涯浪人
天涯浪人 2020-12-02 18:02

Unlike in webstorm, I\'m unable to comment JSX code out in .js files in the Visual Studio Code.

相关标签:
16条回答
  • 2020-12-02 18:44

    {/* this works, but only single line */}

    0 讨论(0)
  • 2020-12-02 18:49

    In React "{}" allows us to use JavaScript Expressions, so we can comment the way we do in JavaScript.

    Example:

    {/* multi 
    line 
    comment 
    */}
    
    {// single line comment
    }
    
    0 讨论(0)
  • 2020-12-02 18:50

    Try to disable all plugins, because they can change editor's behaviour. For example if use Babel ES6/ES7 plugin, editor comments .jsx syntax by // instead of {/*. You see see the issue here.

    0 讨论(0)
  • 2020-12-02 18:50

    For Linux, For a single line, Use Ctrl + /.

    And for multiline, Select the snippets in VSCode Just Hit the Ctrl + Shift + A.

    It works. Happy Coding

    0 讨论(0)
提交回复
热议问题