scrimba
Learn React for free
React Todo App: Phase 4
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

React Todo App: Phase 4
AboutCommentsNotes
React Todo App: Phase 4
Expand for more info
App.js
run
preview
console
/*
In the previous iteration of this todo list app, we pulled in todos data from a JSON file and mapped over it to display the todo items.

Eventually we'll want to be able to modify the data, which will only happen if we've "loaded" the data in to the component's state

Challenge: Change the <App /> component into a stateful class component and load the imported `todosData` into state.
*/

import React from "react"
import TodoItem from "./TodoItem"
import todosData from "./todosData"

function App() {
const todoItems = todosData.map(item => <TodoItem key={item.id} item={item}/>)

return (
<div className="todo-list">
{todoItems}
</div>
)
}

export default App
Console
!
"Warning: Failed prop type: You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`. in input (created by TodoItem) in div (created by TodoItem) in TodoItem (created by App) in div (created by App) in App"
,
index.html
-2:01