Unlike in webstorm, I'm unable to comment JSX code out in .js
files in the Visual Studio 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.
We can write comments in React using the double forward-slash // or the asterisk format /* */, similar to regular JavaScript.
If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code.
You can comment out JSX by {/**/}
Example :
render() { return ( <div> <Component1 /> {/* <Component2 /> */} </div> ) }
and then Component2 would be commented out
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With