const numbers = props.mainPage.room.map(item =>
<NumberRoom key={item.id} number={item.number} storey={item.storey} state={item.state}/>);
const grouped = props.mainPage.room.reduce((acc, n) => (
(acc[n.storey] ??= []).push(n),
acc
), {});
{Object.entries(grouped).map(([ groupName, group ]) => (
<div className="group" key={groupName}>
<h3>{groupName}</h3>
{group.map(n => <NumberRoom key={n.id} {...n} />)}
</div>
))}