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

Best practice is using <React.Fragment> #33

Open
chrisoemma opened this issue May 27, 2019 · 2 comments
Open

Best practice is using <React.Fragment> #33

chrisoemma opened this issue May 27, 2019 · 2 comments

Comments

@chrisoemma
Copy link

Hello people,

I just come across this post which explains why we should not use pointless div just to close the elements in one tag. Chere it here https://www.barrymichaeldoyle.com/fragment/

Let's all be professional developers.

Cheers

@nelsonfrank
Copy link

React. Fragment (Uses)

React.fragment is very important if you are trying to render multiple child components,
All your components supposed to be inside of React.Fragment tag

<React.Fragment>
    <child1 />
    <child2 />
    <child3 />
</React.Fragment>

or

<>
    <child1 />
    <child2 />
    <child3 />
</>

Cheers

@BenMaruchu
Copy link
Contributor

I advice using fragment and also you don't have to call React.Fragment just import React, {Fragment} from 'react'

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

No branches or pull requests

3 participants