React 数据渲染报错

<div className={classes.preview}>
  {Array.isArray(value) &&
    value.length > 0 &&
    value.map((item) =>
      !item.label ? (
        `----`
      ) : dataFromApi ? (
        <span key={item.value}>{`${item.label} `}</span>
      ) : (
        t(`${item.label}`)
      ),
    )}
  {!Array.isArray(value) && value}
</div>

我这样写会报以下错误,是哪里的问题呢?
Error: Objects are not valid as a React child (found: object with keys {label, value}). If you meant to render a collection of children, use an array instead.

第一个判断value为数组join下看看

<div className={classes.preview}>
  {Array.isArray(value) &&
    value.length > 0 &&
    value.map((item) =>
      !item.label ? (
        `----`
      ) : dataFromApi ? (
        <span key={item.value}>{`${item.label} `}</span>
      ) : (
        t(`${item.label}`)
      ),
    ).join('')}
  {!Array.isArray(value) && value}
</div>

react渲染的不是Array,value.map,value不是一个数组

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632