Under the hood, it works just as same as our Aux component above. This can be useful when rendering multiple child. React.Fragment React provides the same functionality above, for wrapping adjacent JSX elements, out-of-the box. Use for when you need to map over a collection of fragments. React Fragments allow you to wrap or group multiple elements without adding an extra node to the DOM. When working in React, its a common pattern to return multiple elements by wrapping them with a container element like div. Make sure you use them as often as necessary. Fragment> instead of the shorthand version <>.
0 Comments
Leave a Reply. |