/
App.jsx
35 lines (30 loc) · 875 Bytes
/
App.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { useMemo, useState } from 'react';
import TableBody from './Table/TableBody';
import TableHead from './Table/TableHead';
import TableColumns from './Table/TableColumns';
import Header from './Header/Header';
import Table from './Table/Table';
import TableInputButton from './Table/TableInputButton';
const App = () => {
const columns = useMemo(() => [ 'Id', 'Name' ], []);
const [rows, setRows] = useState([]);
const setCountry = country => {
setRows(rows => [...rows, {
id: rows.length,
name: country
}]);
};
return <>
<Header title="React Course" />
<div className="container">
<TableInputButton setCountry={ setCountry } />
<Table>
<TableHead>
<TableColumns columns={ columns } />
</TableHead>
<TableBody rows={ rows } />
</Table>
</div>
</>
}
export default App;