const Comp = () => (
<div>
<ul>
<li>
<h2>Cap1</h2>
<p>Text1</p>
</li>
<li>
<h2>Cap2</h2>
<p>Text2</p>
</li>
</ul>
</div>
);
const LiItem = () => {
<li>
<h2>Cap1</h2>
<p>Text1</p>
</li>
}
const Comp = () => (
<div>
<ul>
constants.map(item => LiItem)
</ul>
</div>
);
const data = [{header: "1", text: "1"}, {header: "2", text: "2"}]
const LiItem = ({header, text}) => (
<li>
<h2>{header}</h2>
<p>{text}</p>
</li>
)
const Comp = () => (
<div>
<ul>
{data.map((el, idx) => <LiItem key={idx} header={el.header} text={el.text} />)}
</ul>
</div>
);
const Comp = () => (
<div>
<ul>
constants.map((item) => (
<li>
<h2>Cap1</h2>
<p>Text1</p>
</li>
))
</ul>
</div>
);