Snippets.

Short solutions to discrete problems which can be copied and pasted.

NameDescriptionCategoryLast Updated
VisuallyHidden
A convenient component for contextualizing visual content for screen readers
React Component
Mar 2024
range
Generate an array of numbers, for happy iteration
JavaScript
Mar 2023
useMousePosition
Store the user's cursor position in React state
React Hook
Mar 2022
useRetryUntilResolved
If at first you don't succeed, try try again.
React Hook
Jan 2022
debounce
A classic debounce function, written in modern JS.
JavaScript
Oct 2021
usePrefersReducedMotion
Use animations responsibly! Guard against unintended consequences with this accessible React hook.
React Hook
Oct 2021
useRandomInterval
It's like setInterval, but more random!
React Hook
Jul 2021
useTimeout
A React-friendly wrapper around the 'setTimeout' JavaScript method.
React Hook
Jul 2021
useInterval
A React-friendly alternative to window.setInterval
React Hook
Jul 2021
useStickyState
A modified “useState” hook that uses localStorage to remember state across sessions.
React Hook
Jan 2021
useBoop
Apply a whimsical "temporary hover" effect with this customizable React hook.
React Hook
Nov 2020
ShiftBy
Get ever-closer to pixel-perfection with this handy pixel-tweaking React component.
React Component
Nov 2020
InPortal
Convenient reusable portal component, for dropdowns and tooltips
React Component
Sep 2020
random
Generate a random number in a range. The way we all wish Math.random worked.
JavaScript
May 2020
Scale with Pseudo-elements
A buttery hover effect that doesn't warp or distort your content
HTML & CSS
May 2020
useToggle
Handy syntactic sugar around React.useState, for toggling a boolean value on and off.
React Hook
May 2020
HTML Skeleton
Bootstrap your next project with this batteries-included HTML starter.
HTML & CSS
May 2020
FadeIn
Fade stuff in on mount with this helpful utility component.
React Component
May 2020
useHasMounted
Avoid weird SSR issues with this handy React hook. Know whether you're rendering on the client or server!
React Hook
May 2020