25

I have an issue with WebStorm and React.

Within the render function I type my HTML (JSX) and when I type an attribute for an element, WebStorm will autocomplete it with curly braces instead of speech marks.

Anyone any ideas?

Example problem

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Darren Keen.
  • 512
  • 6
  • 10

2 Answers2

54

You can control this behavior:

File | Settings | Editor | Code Style | HTML | Add for JSX attributes

The "Add for JSX attributes" setting is under the "Other" tab:

enter image description here

Rick
  • 136
  • 12
Attila Szeremi
  • 5,235
  • 5
  • 40
  • 64
  • Could you please elaborate on what to add? – Sayan Jan 31 '19 at 15:20
  • 3
    If you want "speech marks", then set it to "Quotes", or if you want it to try and be smart and show quotes if the attribute is such a type, you can set it to "Based on type". By default, it's set to "Braces". – Attila Szeremi Jan 31 '19 at 17:48
  • 1
    Thanks Attila! I had a tough time finding the "Add for JSX attributes" option which was way under the "Other" tab in HTML. – Sayan Jan 31 '19 at 20:37
3

enter image description here

Yes, Attila's answer is correct. It's a bit confusing though. This screenshot will complement Attila's answer.

vivek agarwal
  • 435
  • 4
  • 6