Created
August 23, 2020 13:52
-
-
Save Aleksey-Danchin/20a3dbcef04f13e39d842ac223129213 to your computer and use it in GitHub Desktop.
CustomTable usage example
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
import React from "react"; | |
import CustomTable from "./Components/CustomTable"; | |
function App() { | |
const users = [ | |
{ | |
id: 1, | |
name: "Алексей", | |
surname: "Данчин", | |
age: 27, | |
}, | |
{ | |
id: 2, | |
name: "Серьгей", | |
surname: "Акаваркин", | |
age: 18, | |
}, | |
{ | |
id: 3, | |
name: "Ольга", | |
surname: "Маск", | |
age: 12, | |
}, | |
]; | |
const fields = [ | |
"id", | |
{ | |
label: "Fullname", | |
value: (item) => `${item.name} ${item.surname}`, | |
}, | |
{ | |
label: "Is adult", | |
value: (item) => (item.age >= 18 ? "Да" : "Нет"), | |
}, | |
]; | |
return <CustomTable data={users} fields={fields} />; | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment