Snippets
small but helpful code examples
useObserver
A useful hook that allows you to know if an element has scrolled into view
React Hook
May 2024
useFullscreen
A hook that wraps the fullscreen API to enable fullscreen mode on a specific element and it children
React Hook
Aug 2023
useKey
A useful hook for detecting key presses and performing specific actions based on the pressed key
React Hook
Jul 2023
useLocalStorage
Let's persist state on page refresh -- sync state to local storage
React Hook
Feb 2023
useOnClickOutside
This hooks allow you to take action when a user clicks outside of an element.
React Hook
Jan 2023
generateTOC
Extract all the headings in a md file and generate a table of contents in the form of a tree structure
Helper function
Jan 2023
useCountdown
Ever wanted to put a countdown in your app?
React Hook
Dec 2022
useCopyToClipboard
Let's copy stuff to your clipboard and have you know when it's done
React Hook
Dec 2022
getRandomNumber
Let's think about intuitively generating random numbers with JavaScript
helper function
Dec 2022
useDebouncedValue
Debounce any fast-changing values to ensure that expensive operations are not executed too frequently.
React Hook
Nov 2022
useFetch
A simple fetching hooking so that you do have to write your own
React Hook
Nov 2022
useToggle
Its like useState but only accepts boolean values
React Hook
Oct 2022