Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the React equivelant of Angulars 'ng-container'

Instead of having a div element, I want an element like 'ng-container' in Angular to avoid useless div elements in the DOM.

What is the React equivalent of Angulars 'ng-container' ?

Explanation of ng-container

like image 918
Jonas Praem Avatar asked Oct 25 '18 09:10

Jonas Praem


1 Answers

You can use React.Fragment

<React.Fragment>
    "Rest of elements here"
</React.Fragment>
like image 132
Filipe Valente Avatar answered Oct 24 '22 16:10

Filipe Valente