javascript - 我的 javascript 中有一个错误,它说 (e) 没有定义
问题描述
我拥有的代码和图像中的错误
import React from 'react';
const Main = () => {
const joiningCriteria = [
'People between the ages of 18 and 35 years.',
'A demonstrated passion for coding and technology.',
'The time and capacity to commit to a full coding bootcamp. Classes are three times per week in person at one of our learning hubs.',
'An intermediate level of English comprehension.',
'The aptitude to succeed in the selection process.',
];
return (
<section class="bootcamp">
<ol>
{joiningCriteria.map(() => (
<li>{e}</li> /*the error is here it say the (e) is not defined*/
))}
</ol>
</section>
);
};
export default Main;
解决方案
您需要在地图中添加您的 e 作为参数。然后,您来自数组的值将显示为列表元素。
<ol>
{joiningCriteria.map((e)=> (<li>{e}</li>))}
</ol>
推荐阅读
- amazon-web-services - 如何避免 AWS/Glue 目录表更改列数据类型?
- javascript - 我如何在不使用任何节点模块的情况下处理多部分表单数据
- javascript - 有 2 个相同的接收值来自一个 Promise:在一种情况下它可以工作,在另一种情况下它给出一个 TypeError: x is not a function
- c# - 是否可以简化以下 Linq 表达式?
- regex - 修改 Robocopy 脚本以读取附加到文件夹中文件的编号,添加一个,并重命名正在复制的文件
- php - 即使我添加另一个值,选项标记中的值属性也设置为 0
- node.js - 在 Js 中将对象 Promise 转换为字符串
- node.js - Node js + TypeSc + Babel“错误:找不到模块'koa'”
- colors - 使用 Alpha 通道/不透明度时颜色变暗
- node.js - Node.js 中的进程是什么