mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-14 13:14:30 -08:00
redux example init
This commit is contained in:
26
docs/examples/todos/src/components/TodoList.js
Normal file
26
docs/examples/todos/src/components/TodoList.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import Todo from './Todo'
|
||||
|
||||
const TodoList = ({ todos, toggleTodo }) => (
|
||||
<ul>
|
||||
{todos.map(todo =>
|
||||
<Todo
|
||||
key={todo.id}
|
||||
{...todo}
|
||||
onClick={() => toggleTodo(todo.id)}
|
||||
/>
|
||||
)}
|
||||
</ul>
|
||||
)
|
||||
|
||||
TodoList.propTypes = {
|
||||
todos: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.number.isRequired,
|
||||
completed: PropTypes.bool.isRequired,
|
||||
text: PropTypes.string.isRequired
|
||||
}).isRequired).isRequired,
|
||||
toggleTodo: PropTypes.func.isRequired
|
||||
}
|
||||
|
||||
export default TodoList
|
||||
Reference in New Issue
Block a user