Skip to content

Instantly share code, notes, and snippets.

@Aleksey-Danchin
Created August 23, 2020 13:52
Show Gist options
  • Save Aleksey-Danchin/20a3dbcef04f13e39d842ac223129213 to your computer and use it in GitHub Desktop.
Save Aleksey-Danchin/20a3dbcef04f13e39d842ac223129213 to your computer and use it in GitHub Desktop.
CustomTable usage example
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