DEV Community

Saugat Rai
Saugat Rai

Posted on

4

Was not able to comment out jsx in react, so I made my own snippets

While I was on a react project, I was not able to comment out jsx which was really frustrating.

The way we comment out jsx is
{/* comment */}

But the default comment function on vscode doesnot comment out jsx. So, I made my own snippets to comment out jsx.

First, open command palette

Search for configure user snippets. But before choosing, look for the language type on your work file.

Then choose javascript or javascriptreact.

After that you will see some examples of how you can make a snippets. Copy below code and paste it.

"Comment out jsx": {
"prefix": "jsx",
"body": [
"{/*",
"${TM_SELECTED_TEXT}",
"*/}"
],
"description": "Comment out jsx"
}

Save the file and you are good to go.

Select the code you want to comment and insert snippets.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay