i have business and i'm trying to return business array and i'm using map concept for this and i'm trying add new section when index == 3 also i'm trying to get this result without add parent div. please check my code js fiddle demo
const business = [
"business1",
"business2",
"business3",
"business4",
"business5"
]
class Hello extends React.Component {
render() {
return (
<div>
{
business.map((data,index) => {
return index===3 ? <div>New Section</div><div>{data}</div>:<div>{data}</div>
})
}
</div>
)
}
}
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
if i add parent parent div i can able to get result but i would like to achieve result without adding parent div when index === 3 because i cannot achieve my design output when adding parent expected output
business1
business2
business3
newsection
business4
business5