Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding JSX #554

Closed
2color opened this issue Jun 23, 2016 · 2 comments

Comments

@2color
Copy link

commented Jun 23, 2016

I have a question regarding the combination of JSX, ternary operators and indentation.

Assuming I have the following in my render function:

{
          removable
          ? <FloatingActionButton
            disabled={disabled || readonly}
            mini
            onClick={this.onDropIndexClick(index)}
            secondary
            <ContentRemove />
          </FloatingActionButton>
          : null
}

This is correct according to standard however It feels to me that all the props should be indented one level deeper to look as follows:

{
          removable
          ? <FloatingActionButton
              disabled={disabled || readonly}
              mini
              onClick={this.onDropIndexClick(index)}
              secondary
              <ContentRemove />
            </FloatingActionButton>
          : null
}

Which one do you think is correct and why?

@dcousens

This comment has been minimized.

Copy link
Member

commented Jun 24, 2016

The first, as it is only 1 indent level, not 2.

@2color

This comment has been minimized.

Copy link
Author

commented Jun 24, 2016

Thanks @dcousens

@2color 2color closed this Jun 24, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.