Answer the question
In order to leave comments, you need to log in
Can't implement a system with map?
I'm trying to make a system where, in the absence of elements in the array, display a certain text, but it is not displayed. Can you suggest what I need to fix?
<div className={styles.flows__select}>
{data.user.flows
.filter((flow) =>
data.offers.filter((x) => x.name === flow.name)[0])
.map((flow, index, arr) => {
if (arr.length == 0) {
return (
<div key={index} className={styles['flows__item-empty']}>
У вас нет запущенных потоков.
</div>
)
} else {
return (
<div key={index} className={styles.flows__item}>
{flow.name}
</div>
);
}
})}
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question