Skip to content

Instantly share code, notes, and snippets.

View AbePlays's full-sized avatar
🎮
Enjoying Spider-Man 2

Abhishek Rawat AbePlays

🎮
Enjoying Spider-Man 2
View GitHub Profile
import { useState, type TouchEvent } from 'react'
interface SwipeInput {
onSwipedLeft: () => void
onSwipedRight: () => void
}
interface SwipeOutput {
onTouchStart: (e: TouchEvent) => void
onTouchMove: (e: TouchEvent) => void
@AbePlays
AbePlays / useInterval.tsx
Created July 12, 2022 04:02
UseInterval
import { useEffect, useRef, useState } from 'react';
interface UseIntervalProps {
fn: () => void;
interval: number;
}
interface UseIntervalReturn {
active: boolean;
start: () => void;
@AbePlays
AbePlays / Image.tsx
Created September 20, 2021 09:34
Custom Image Component
const ImgWithFallback = ({
src: string,
fallback: string,
type = 'image/webp',
...props
}) => {
return (
<picture>
<source srcSet={src} type={type} />
<img src={fallback} {...props} />