3 ms·
JSX combines HTML and JS so this recommendation is basically telling you to use double-quotes for HTML and single-quotes for JS which doesn't seem all that craz
by nacs 9y ago
JSX combines HTML and JS so this recommendation is basically telling you to use double-quotes for HTML and single-quotes for JS which doesn't seem all that crazy.
- ng12 9y agoWhy? It looks like HTML but it's still JS. Keep it simple. EDIT: The more I think about it the more wrong it feels. Would you do something like this? <Foo bar="bar" baz={qux && 'biz'} />
- always_good 9y agoYes, that example looks fair enough. One is "HTML", the other is a JS expression. In fact, having single vs double here might help people remember those are different contexts. But realize you're just bikeshedding a trivial matter. All that really matters is that everyone on the team uses the same linting rules and there is no problem except some offended opinions about aesthetics. It's fun to argue aesthetics but it's a waste of time.
- ng12 9y agoEr, style guides deal a lot with aesthetics. That's kind of the subject matter at hand. I think it's silly to add another rule to remember with such a weak justification.