Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 408
Y.H. Eng Avatar asked Jul 20 '16 13:07

Y.H. Eng


People also ask

How do I comment out JSX code?

If you want to comment something in JSX you need to use JavaScript comments inside of Curly braces like {/*comment here*/}. It is a regular /* Block Comments */ , but need to be wrapped in curly braces.

How do you comment in react code in vs JS?

We can write comments in React using the double forward-slash // or the asterisk format /* */, similar to regular JavaScript.

How do you comment out lines in code in VSCode?

If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code.


1 Answers

You can comment out JSX by {/**/}

Example :

render() {   return (     <div>       <Component1 />       {/* <Component2 /> */}     </div>   ) } 

and then Component2 would be commented out

like image 111
erichardson30 Avatar answered Sep 30 '22 04:09

erichardson30