I am attempting to incorporate a child div
component (div-col inside of div-row) when the button is clicked. In this case, I am changing the card layout from grid to list view using Bootstrap classes.
If the current view is set to grid view
:
<div className="row">
{notes.map((item, key) => {
return <Noteitem />;
})}
</div>
On clicking the button for listview
:
<div className="row">
<div className="col">
{notes.map((item, key) => {
return <Noteitem />;
})}
</div>
</div>
Do I need to handle separate DOM return statements for both cases? Open to suggestions for alternative approaches as well.