Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aux Component vs React Fragment which one is better?

Tags:

reactjs

I have completed a course where instructor used Aux component to get rid of adding extra nodes to the DOM like below:

const Aux = props => props.children
export default Aux;

React has also a default component React.Fragment to get rid of adding extra nodes to the DOM.

I know they both are same. Is it right? If yes, which one is better?

If no, What's the difference between them?


1 Answers

They are basically the same. I use <> </> which is React.Fragment but even simpler, I believe it came out for last and looks better in my opinion.

like image 164
Ana Gerhardt Avatar answered Feb 04 '26 14:02

Ana Gerhardt