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

Not working with Fragment shorthand #40

Closed
redbmk opened this issue Sep 7, 2018 · 5 comments
Closed

Not working with Fragment shorthand #40

redbmk opened this issue Sep 7, 2018 · 5 comments

Comments

@redbmk
Copy link
Contributor

redbmk commented Sep 7, 2018

When using React's short Fragment syntax (<>/</>), some styling breaks. It seems fine unless you put something in a {} block without being wrapped in a jsx element.

import React, { Fragment } from "react";

export const ThisWorks = () => (
  <>
    <div>
      <span>Hello</span>
    </div>
  </>
);

export const SoDoesThis = ({ someProps }) => (
  <>
    <div>
      <span>Hello</span>
    </div>
    <div>
      <span>World</span>
    </div>
  </>
);

export const ThisDoesNot = ({ shouldSayHi }) => (
  <>
    {shouldSayHi && (
      <div>
        <span>Hello</span>
      </div>
    )}
    <div>
      <span>World</span>
    </div>
  </>
);

export const ButThisDoes = ({ shouldSayHi }) => (
  <Fragment>
    {shouldSayHi && (
      <div>
        <span>Hello</span>
      </div>
    )}
    <div>
      <span>World</span>
    </div>
  </Fragment>
);
@chemzqm
Copy link
Member

chemzqm commented Sep 8, 2018

Yep, it's not supported yet.

@redbmk
Copy link
Contributor Author

redbmk commented Sep 10, 2018

You rock! ❤️

@redbmk
Copy link
Contributor Author

redbmk commented Sep 10, 2018

@chemzqm This latest change fixed the fragment shorthand, but actually broke some basic javascript comparison syntax 😱 :

before

image

after

image

@chemzqm
Copy link
Member

chemzqm commented Sep 10, 2018

Fixed

@redbmk
Copy link
Contributor Author

redbmk commented Sep 10, 2018

Awesome, thanks! Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants