Jul 17, 2024
FragmentDemo.js
rfc
snippet to create a functional componentApp.js
<h1>
tag<p>
tag<div>
tag<div>
tag is added<div>
tag in DOM<div>
with React.Fragment
Table.js
and Columns.js
<div>
with <table>
<tbody>
and <tr>
for rowsColumns
component<td>Name</td>
and <td>Vishwas</td>
<div>
due to multiple elements<td>
cannot be child of <div>
<td>
within a <div>
tag<div>
in Columns.js
with React.Fragment
<div>
in DOMitems.map(item => (
<React.Fragment key={item.id}>
<h1>Title</h1>
<p>{item.title}</p>
</React.Fragment>
))
React.Fragment
with empty <>
and </>
tagsitems.map(item => (
<>
<h1>Title</h1>
<p>{item.title}</p>
</>
))
React.Fragment
or shorthand <>
</>