问题描述
let headerKeys = {
eventKey: '',content: ''
};
let bodyKeys = {
eventKey: '',content: ''
};
headerKeys = otherSites.map(function (site) {
return {
eventKey: site.pk,content: <Link className={styles.linkStyle} to={`/console/customer/${customerPk}/site/${site.pk}`}>{site.name}</Link>
};
});
bodyKeys = otherSites.map(function (site) {
return {
eventKey: site.pk,content: <CustomerSite
customerSite@R_528_4045@ion={site}
customerPk={customerPk}
name={'site' +' '+ site.pk}/>
};
});
}
const header = [
{
eventKey: 'primary',content: <Link className={styles.linkStyle} to={`/console/customer/${customerPk}/site/${primarySitePk}`}>{primarySiteName}</Link>
},...headerKeys
];
const body = [
{
eventKey: 'primary',content: <CustomerSite
customerSite@R_528_4045@ion={primarySite}
customerPk={customerPk}
name={'primary site'}/>
},...bodyKeys
];
以上是传播错误即将到来的代码段。将react脚本更新到2.8后,出现以下错误。我不确定如何以其他方式使用 spread 运算符来绕过它。自从我弹出create-react-app并不需要它以来,我还没有定义任何babel插件。任何帮助将不胜感激。
**Error as follows**
TypeError: Invalid attempt to spread non-iterable instance
_nonIterableSpread
node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js:2
1 | export default function _nonIterableSpread() {
> 2 | throw new TypeError("Invalid attempt to spread non-iterable instance");
3 | }
View compiled
_toConsumableArray
node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js:5
2 | import iterabletoArray from "./iterabletoArray";
3 | import nonIterableSpread from "./nonIterableSpread";
4 | export default function _toConsumableArray(arr) {
> 5 | return arrayWithoutHoles(arr) || iterabletoArray(arr) || nonIterableSpread();
6 | }
View compiled
CustomerSitesContainer.render
src/containers/CustomerSiteContainer.js:123
120 | });
121 | }
122 | const header = [
> 123 | {`enter code here`
| ^ 124 | eventKey: 'primary',125 | content: <Link className={styles.linkStyle} to={`/console/customer/${customerPk}/site/${primarySitePk}`}>{primarySiteName}</Link>
126 | },View compiled
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)