Search code examples
javascriptjsonreactjsvisual-studio-codecode-snippets

Custom react code snippets not working in vscode in javascriptreact.json file


I want to add a few custom React.js code snippets in VSCode. I realize there are two files in VSCode for this. javascript.json and javascriptreact.json. javascript.json works just fine but when I move the snippets to javascriptreact.json, VSCode doesn't recognize them.

It'll be great if I could isolate these snippets in javacriptreact.json file because I also write server side JavaScript.

I'm guessing that VSCode doesn't recognize the app as a React app. Is there anyway to fix this?


Solution

  • save file with.jsx extension instead of .js. i.e. code snippets you are seeing in javascript.json is because you are editing a .js file