Skip to content

Instantly share code, notes, and snippets.

View nafeu's full-sized avatar
🕶️
In Virtual Reality

Nafeu Nasir nafeu

🕶️
In Virtual Reality
View GitHub Profile
const recursivelyUpdateTable = ({ tableData, childData, id }) => {
return insertIntoTable({
existingRows: tableData,
subRowsToInsert: childData,
path: id.split('.')
});
}
const insertIntoTable = ({ existingRows, subRowsToInsert, path }) => {
const id = path[0];
const TableInstance = ({ tableData }) => {
const [columns, data] = useMemo(
() => {
const columns = [
{
Header: 'Topic',
accessor: 'name'
},
{
Header: 'Active Members',
const TableQuery = () => {
const queryClient = useQueryClient();
const [tableData, setTableData] = useState(null);
const { data: apiResponse, isLoading } = useQuery('discussionGroups', fetchData);
useEffect(() => {
setTableData(apiResponse?.data);
}, [apiResponse])
[
{
"id": 1,
"name": "How to use react-table in reporting dashboard",
"active": 40,
"status": "locked",
"upvotes": 30
},
{
"id": 2,
const TableLayout = ({
getTableProps,
getTableBodyProps,
headerGroups,
rows,
prepareRow,
}) => {
return (
<table {...getTableProps()}>
<thead>
/* Step 5: Build additional asset files */
Deno.writeTextFileSync(`${buildPath}/styles.css`, styles ? styles : '');
Deno.writeTextFileSync(`${buildPath}/favicon.svg`, getFaviconSvg(favicon));
deno run --allow-read --allow-write --unstable main.ts example.md
/* Step 4: Build pages into .html files with appropriate paths */
for (const page of pages) {
const { path } = page;
let outputPath: string;
if (path === HOME_PATH) {
outputPath = `${buildPath}/index.html`;
} else {
outputPath = `${buildPath}${path}/index.html`;
{ outputPath: "./build/index.html" }
{ outputPath: "./build/about/index.html" }
/* Step 4: Build pages into .html files with appropriate paths */
for (const page of pages) {
const { path } = page;
let outputPath: string;
if (path === HOME_PATH) {
outputPath = `${buildPath}/index.html`;
} else {
outputPath = `${buildPath}${path}/index.html`;