File tree Expand file tree Collapse file tree 5 files changed +26
-16
lines changed Expand file tree Collapse file tree 5 files changed +26
-16
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,34 @@ import { TodoList } from './TodoList';
44import { TodoItem } from './TodoItem' ;
55import { CreateTodoButton } from './CreateTodoButton' ;
66import './App.css' ;
7+ import React from 'react' ;
8+
9+ const defaultTodos = [
10+ { text : "Cortar cebolla" , completed : true } ,
11+ { text : "Tomar el curso de ReactJS" , completed : false } ,
12+ { text : "Llorar con la llorona" , completed : false } ,
13+ { text : "Otra tarea pendiente" , completed : false }
14+ ] ;
715
816function App ( ) {
917 return (
10- < div className = "App" >
11-
12- < TodoCounter />
18+ < React . Fragment >
19+
20+ < TodoCounter completed = { 16 } total = { 25 } />
1321 < TodoSearch />
1422
1523 < TodoList >
16- < TodoItem />
17- < TodoItem />
18- < TodoItem />
24+ { defaultTodos . map ( todo => (
25+ < TodoItem
26+ key = { todo . text }
27+ text = { todo . text }
28+ completed = { todo . completed }
29+ />
30+ ) ) }
1931 </ TodoList >
2032
2133 < CreateTodoButton />
22- </ div >
34+ </ React . Fragment >
2335 ) ;
2436}
2537
Original file line number Diff line number Diff line change 11function CreateTodoButton ( ) {
22 return (
3- < button >
4- +
5- </ button >
3+ < button > +</ button >
64 ) ;
75}
86
Original file line number Diff line number Diff line change 1- function TodoCounter ( ) {
1+ function TodoCounter ( { total , completed } ) {
22 return (
33 < h1 >
4- Completaste 3 de 5 TODOS
4+ Completaste { completed } de { total } TODOS
55 </ h1 >
66 ) ;
77}
Original file line number Diff line number Diff line change 1- function TodoItem ( ) {
1+ function TodoItem ( props ) {
22 return (
33 < li >
44 < span > V</ span >
5- < p > Llorar con la Llorona </ p >
5+ < p > { props . text } </ p >
66 < span > X</ span >
77 </ li >
88 ) ;
Original file line number Diff line number Diff line change 1- function TodoList ( props ) {
1+ function TodoList ( { children } ) {
22 return (
33 < ul >
4- { props . children }
4+ { children }
55 </ ul >
66 ) ;
77}
You can’t perform that action at this time.
0 commit comments