Question - What are fragments?
Answer -
In was introduced in React 16.2 version. In React, Fragments are used for components to return multiple elements. It allows you to group a list of multiple children without adding an extra node to the DOM.
Example
render() {
return (
)
}
There is also a shorthand syntax exists for declaring Fragments, but it's not supported in many tools:
render() {
return (
<>
>
)
}