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
28 lines
558 B
JavaScript
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>;
|