Adjacent elements in a React component without wrapping
To build a React component with multiple adjacent elements without wrapping them in a tag or container div, use React.Fragment:
render() {
return <React.Fragment>
<SubComponentOne />
<SubComponentTwo />
</React.Fragment>;
}
There is also a shorthand syntax:
render() {
return <>
<SubComponentOne />
<SubComponentTwo />
</>;
}
Documentation: