Skip to content

Commit 8d6a1b4

Browse files
committed
Merge pull request airbnb#534 from cooperka/react-quote-reasoning
Add reasoning for using double quotes in JSX
2 parents f823047 + ef7fbea commit 8d6a1b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

react/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@
117117

118118
## Quotes
119119
- Always use double quotes (`"`) for JSX attributes, but single quotes for all other JS.
120+
121+
> Why? JSX attributes [can't contain escaped quotes](http://eslint.org/docs/rules/jsx-quotes), so double quotes make conjunctions like `"don't"` easier to type.
122+
> Regular HTML attributes also typically use double quotes instead of single, so JSX attributes mirror this convention.
123+
120124
```javascript
121125
// bad
122126
<Foo bar='bar' />

0 commit comments

Comments
 (0)