how to use beautify for javascript/react?

不想你离开。 提交于 2021-02-08 08:00:18

问题


I have installed Beautify to use it for my react.js code. However, it apparently does not properly beautify the html format in the file. For example,

it turns this:

into this:

Among all the options, which option should I use to fix this ?


回答1:


I used to have the same problem. Apparently beautify doesn't support JSX. I uninstalled and instead of it, I installed Prettier, it works great for me.

Hope I helped you.




回答2:


Just change language mode javascript to javascript react [temporary]

VSCode Command: (Ctrl + KM)

Or Save file in .jsx format and change the settings.json file

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


来源:https://stackoverflow.com/questions/52638793/how-to-use-beautify-for-javascript-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!