import React, { useContext, useEffect, useState } from 'react'
import { todo } from '../types.dt'
import TodoCount from '../Components/TodoCount'
import List from '../Components/TodoList/List'
import { Provider } from '../Context Api/Todos'
import TodoCreate from '../Components/TodoCreate'
const Todo = () => {
    const [Todos, setTodos] = useState<todo[]>([])
    const { state, handleCreate, handleDelete, handleUpdate } = useContext(Provider)

    return (
        <>
            <TodoCount count={state.length} />
            <List Todo={state} handleDelete={handleDelete} handleUpdate={handleUpdate} />
            <TodoCreate handleCreate={handleCreate} />
        </>
    )
}

export default Todo