Skip to content

Instantly share code, notes, and snippets.

View adnanirfan's full-sized avatar
🏓
while(true) eat(); sleep(); code();

Adnan Irfan adnanirfan

🏓
while(true) eat(); sleep(); code();
  • Geeks of Kolachi
  • Karachi
View GitHub Profile
import axios from 'axios';
import fs from 'fs';
const images = ["https://avatars.githubusercontent.com/u/9200214?s=500&v=2"];
(async () => {
function getImage(url, index) {
try {
axios({
method: 'get',
url,
@adnanirfan
adnanirfan / PaginationSSR.jsx
Created June 9, 2023 13:46
Next.js component to handle Paginations with Server Side Rednering
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { QueryClient, dehydrate, useQuery } from "@tanstack/react-query";
// import Pagination from "@material-ui/lab/Pagination";
export default function PaginationSSR(props) {
const router = useRouter();
const [page, setPage] = useState(parseInt(router.query.page) || 1);