DEV Community

Discussion on: React Fragments

Collapse
 
daveskull81 profile image
dAVE Inden

Great post. Previously I had only seen the React.Fragment or <> </> methods for using fragments. That’s cool to see the destructuring method to use instead. I like that as it semantically helps to know what the element is doing and helping build tools is great too.

Collapse
 
sarah_chima profile image
Sarah Chima

Thanks Dave. I'm glad you find the post useful.

Collapse
 
daveskull81 profile image
dAVE Inden

I just used the destructuring approach in a Gatsby project of mine. When I first implemented it the code didn't compile, so I came back to this post and found my mistake. I had messed up the import statement. Thanks again!

Thread Thread
 
sarah_chima profile image
Sarah Chima

We all make mistakes as devs. I'm glad the post helped you to fix it.

Thread Thread
 
daveskull81 profile image
dAVE Inden

Oh yes. I’m more than happy to make mistakes and learn from them.

Collapse
 
miku86 profile image
miku86

That's not destructuring, it is a named import.

Differences: youtube.com/watch?v=4keUSxNw-KE