Created
August 10, 2020 20:07
-
-
Save hyber1z0r/3c069994adb5d032fb6390bb59de2300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
type Todo = { | |
id: number; | |
title: string; | |
completed: boolean; | |
} | |
type Props = { | |
todo: Todo; | |
} | |
const TodoItem = ({ todo }: Props) => { | |
return ( | |
<li>{todo.title}</li> | |
) | |
}; | |
const TodoList = () => { | |
const todos: Todo[] = [ | |
{ id: 1, title: 'Buy nachos', completed: false }, | |
{ id: 2, title: 'Buy avocado', completed: true }, | |
{ id: 3, title: 'Buy ground beef', completed: false }, | |
]; | |
return ( | |
<ul> | |
{todos.map((todo) => <TodoItem key={todo.id} todo={todo} />)} | |
</ul> | |
) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment