why fragment in react code example
Example 1: react fragment
render() {
return (
<React.Fragment>
<ChildA />
<ChildB />
<ChildC />
</React.Fragment>
);
}
Example 2: how to use react fragment
//the same way you'd use any other element
//except that it doesn't support keys or attributes.
render() {
return (
<>
<p>Hello</p>
<p>World!</p>
</>
);
}