Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use beautify for Javascript/React?

I have installed Beautify to use it for my ReactJS code. However, it apparently does not properly beautify the HTML format in the file.

For example, it turns this:

enter image description here

into this: enter image description here

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

like image 943
Jay Jeong Avatar asked Oct 22 '25 06:10

Jay Jeong


2 Answers

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.

like image 137
Carlos Emiliano Castro Trejo Avatar answered Oct 24 '25 20:10

Carlos Emiliano Castro Trejo


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"
}
like image 39
Razib Hossain Avatar answered Oct 24 '25 20:10

Razib Hossain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!