question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistency in single line jsx components

See original GitHub issue

Here is a single line component, wrapped in parentheses: prettier playground

const FormError = ({ error }) => (
  <p>I am a very very very very very very long text</p>
)

Here is the same component with another contents, the parentheses are gone: prettier playground

const FormError = ({ error }) =>
  error || <p>I am a very very very very very very long text</p>

Prettier 1.6.1

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
rattrayalexcommented, Aug 31, 2017

Another possible solution:

const FormError = ({ error }) => error || (
  <p>I am a very very very very very very long text</p>
)
4reactions
rattrayalexcommented, Sep 6, 2017

Just to isolate, thoughts on this?

const FormError = ({ error }) => 
  error || (
    <p>I am a very very very very very very long text</p>
  )
Read more comments on GitHub >

github_iconTop Results From Across the Web

inconsistent value of input in react when removing dom
1 bug for sure is that when you are setting the ID of the items to the length. So if you add 2,...
Read more >
8 common React error messages and how to address them
React Hook useXXX is called conditionally. React Hooks must be called in the exact same order in every component render; React Hook has...
Read more >
Concurrent UI Patterns (Experimental) - React
The tradeoff we're making here is that <ProfileTimeline> will be inconsistent with other components and potentially show an older item. Click “Next” a...
Read more >
FormControl API - Material UI - MUI
API reference docs for the React FormControl component. Learn about the props, ... You can find one composition example below and more going...
Read more >
Rationale - Prettier
JSX takes its roots from HTML, where the dominant use of quotes for attributes is ... Prettier collapses multiple blank lines into a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found