Skip to content

Commit 3e6e5a2

Browse files
committed
input field
1 parent 7e5f4d2 commit 3e6e5a2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/App.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React, { useState } from 'react';
2+
3+
const initalTodos = [
4+
{
5+
id: 'a',
6+
task: 'Learn React',
7+
complete: true,
8+
},
9+
{
10+
id: 'b',
11+
task: 'Learn Firebase',
12+
complete: true,
13+
},
14+
{
15+
id: 'c',
16+
task: 'Learn GraphQL',
17+
complete: false,
18+
},
19+
];
20+
21+
const App = () => {
22+
const [task, setTask] = useState('');
23+
24+
const handleChangeInput = event => {
25+
setTask(event.target.value);
26+
};
27+
28+
return (
29+
<div>
30+
<ul>
31+
{initalTodos.map(todo => (
32+
<li key={todo.id}>
33+
<label>{todo.task}</label>
34+
</li>
35+
))}
36+
</ul>
37+
38+
<input type="text" value={task} onChange={handleChangeInput} />
39+
</div>
40+
);
41+
};
42+
43+
export default App;

0 commit comments

Comments
 (0)