-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba8c4e4
commit fc3c968
Showing
5 changed files
with
23 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import React, { useContext } from 'react'; | ||
import React, { useContext, useEffect } from 'react'; | ||
import { Header } from './components/Header'; | ||
import { TodoList } from './components/TodoList'; | ||
import { Footer } from './components/Footer'; | ||
import { TodosContext, TodosProvider } from './services/TodosContext&Provider'; | ||
import { TodosContext } from './services/TodosContext&Provider'; | ||
|
||
export const App: React.FC = () => { | ||
const { todos } = useContext(TodosContext); | ||
|
||
useEffect(() => { | ||
console.log(todos); | ||
}, [todos]); | ||
|
||
return ( | ||
<TodosProvider> | ||
<div className="todoapp"> | ||
<h1 className="todoapp__title">todos</h1> | ||
<Header /> | ||
<div className="todoapp"> | ||
<h1 className="todoapp__title">todos</h1> | ||
<Header /> | ||
|
||
<div className="todoapp__content"> | ||
<TodoList /> | ||
<div className="todoapp__content"> | ||
<TodoList /> | ||
|
||
{!!todos.length && <Footer />} | ||
</div> | ||
{!!todos.length && <Footer />} | ||
</div> | ||
</TodosProvider> | ||
</div> | ||
); | ||
}; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ export const useTodo = () => { | |
|
||
return { | ||
todos, | ||
setTodos, | ||
addTodo, | ||
removeTodo, | ||
clearCompleted, | ||
|
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