感谢您帮助我摆脱困境。我对 REACT 很陌生,显然在一些基本概念上绊倒了。感谢您的帮助。
这是我的 app.js:
import React from "react";
import TodoItem from "./components/TodoItem";
import todosData from "./components/todosData"
function App() {
const todoComponents = todosData.map((todo) => (
<TodoItem key={todo.id} todo={todo.text} />
));
console.log(todoComponents);
return(
<div className="todo-list">
<todoComponents />,
</div>
)
}
export default App;
todoData.js:
const todosData = [{
id: "1",
text: "Take out the trash",
completed: true,
},
{
id: "2",
text: "Grocery Shopping",
completed: false,
},
{
id: "3",
text: "Clean Garage",
completed: false,
},
{
id: "4",
text: "Mow Lawn",
completed: false,
},
{
id: "5",
text: "Catch up on courses",
completed: false,
},
];
export default todosData;
“todoComponents”以小写“t”开头的错误屏幕。下一个屏幕将在使用大写 T 时显示错误。
应用程序.js:
import React from "react";
import TodoItem from "./components/TodoItem";
import todosData from "./components/todosData"
function App() {
const TodoComponents = todosData.map((todo) => (
<TodoItem key={todo.id} todo={todo.text} />
));
console.log(TodoComponents);
return(
<div className="todo-list">
<TodoComponents />,
</div>
)
}
export default App;
错误画面 2
请询问您是否需要更多信息