Skip to content

Instantly share code, notes, and snippets.

View CodeDrivenDevelopment's full-sized avatar
💭
I may be slow to respond.

CodeDrivenDevelopment

💭
I may be slow to respond.
View GitHub Profile
@CodeDrivenDevelopment
CodeDrivenDevelopment / fetch-any.tsx
Created April 20, 2024 19:45
Some demo js files for showing how window.fetch works. Used for a demo on https://codedrivendevelopment.com/
'use client';
import { useState } from 'react';
const baseUrl = 'https://pokeapi.co/api/v2/pokemon/ditto';
const apiUrlWithCacheBusting = () => `${baseUrl}?${Date.now()}`;
export default function FetchDemo() {
const [abortTimeout, setAbortTimeout] = useState(50);
const [messages, setMessages] = useState<string[][]>([]);