Skip to content

Instantly share code, notes, and snippets.

@Ateevduggal
Created June 11, 2022 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ateevduggal/3a7a211f19eb7b75a7d7be18d937ee2b to your computer and use it in GitHub Desktop.
Save Ateevduggal/3a7a211f19eb7b75a7d7be18d937ee2b to your computer and use it in GitHub Desktop.
import React, { useState } from "react";
import { data } from "./Data";
export const App = () => {
return (
<>
<div className="container-fluid">
<div className="row pt-5">
<form>
<table className="table table-striped table-primary table-hover text-center fs-5 table-bordered border-dark">
<thead>
<tr>
<th id="tr" onClick={() => Sort("fullName")}>
Name
</th>
<th id="tr" onClick={() => Sort("userName")}>
User Name
</th>
<th id="tr" onClick={() => Sort("phoneNumber")}>
Phone Number
</th>
<th id="tr" onClick={() => Sort("website")}>
Website
</th>
<th id="tr" onClick={() => Sort("companyName")}>
Company Name
</th>
<th id="tr" onClick={() => Sort("email")}>
Email
</th>
<th id="tr">Action</th>
</tr>
</thead>
<tbody>
{data.map((data) => {
return (
<>
<tr>
<td>{data.fullName}</td>
<td>{data.userName}</td>
<td>{data.phoneNumber}</td>
<td>{data.website}</td>
<td>{data.companyName}</td>
<td>{data.email}</td>
<td className="d-flex p-4">
<button className="btn btn-dark me-3">
<i class="fa-solid fa-pen-to-square"></i>
</button>
<button className="btn btn-danger">
<i class="fa-solid fa-trash"></i>
</button>
</td>
</tr>
</>
);
})}
</tbody>
</table>
</form>
</div>
</div>
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment