Files
test-repo/tests/jsx/hug.js
T
Christopher Chedeau 573936aacc [RFC] Hug Conditionals in JSX (#473)
Conditionals are very common in JSX and it is unfortunate that they take up so much vertical space in the current prettier.

This pull request does a few tweaks:
 - It hugs ConditionalExpression (ternary) and LogicalExpression (&&) inside of `{}` in a jsx child, not an attribute
 - It doesn't output parenthesis if your parent is a LogicalExpression (&&)

Fixes #317
2017-01-26 14:51:08 -05:00

28 lines
558 B
JavaScript

<div>
{__DEV__
? this.renderDevApp()
: <div>
{routes.map(route => (
<MatchAsync
key={`${route.to}-async`}
pattern={route.to}
exactly={route.to === "/"}
getComponent={routeES6Modules[route.value]}
/>
))}
</div>}
</div>;
<div>
{__DEV__ && <div>
{routes.map(route => (
<MatchAsync
key={`${route.to}-async`}
pattern={route.to}
exactly={route.to === "/"}
getComponent={routeES6Modules[route.value]}
/>
))}
</div>}
</div>;