Fragment(react fragments)
πŸŒ‡

Fragment(react fragments)

when we define a custom element then we have to return the JSX code wrapped in the single div because we can’t provide more than one return elements in the jsx then we have to wrapp it with an unaccessary div
instead we can use the <> </> in place of that which is a valid syntax in react
or we can use the react fragment
πŸ’‘
just we have to import it from react
import {Fragment} from 'react'
then we can use
<Fragment> // your jsx code </fragment>
It will not take any space or disturb any hiearcy in the dom and not provide any extra div in the dom
Β