Skip to content
Advertisement

why vscode is not recognizing react code as react javascript instead it format it as vanilla javascript

I am using Prettier with format on save enabled but when I make any change in App.js and save it Prettier do destroy my code because it deals with it as plain javascript

Advertisement

Answer

I am using create-react-app so it produce the main component App.js I am using .JSX in the other components but the problem is when I make any change to the App.js

I fixed this issue by changing the files associations setting in Vscode settings (specific to user workspace)

I just added this line

    "files.associations": {
        "*.js": "javascriptreact"
}

and worked perfectly for me.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement