Answer the question
In order to leave comments, you need to log in
What type to give an array of html elements?
Here is an example card:
const card = (
<div className="card">
{image}
<p className="formCard-item formCard-name">
Name: <span>{name}</span>
</p>
<p className="formCard-item formCard-gender">
Gender: <span>{gender}</span>
</p>
<p className="formCard-item formCard-birth">
Who was born: <span>{birthday}</span>
</p>
<p className="formCard-item formCard-continent">
From: <span>{continent}</span>
</p>
</div>
);
Answer the question
In order to leave comments, you need to log in
Why didn't JSX.Element[] fit?
But I usually put React.ReactNode (for array React.ReactNode[]) because a node can be not only a JSX element, but also a string, null, an array, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question