React Hooked
Docs
  • Getting started
  • Testing
  • Hooks
    • useBattery
    • useBeforeUnload
    • useBoolean
    • useClickAway
    • useCookie
    • useCopyToClipboard
    • useCountdown
    • useCounter
    • useDebounce
    • useDetectDevice
    • useDocumentTitle
    • useEventListener
    • useFavicon
    • useFullscreen
    • useGeolocation
    • useHash
    • useHistoryState
    • useHover
    • useIdle
    • useIntersectionObserver
    • useInterval
    • useIsClient
    • useIsFirstRender
    • useIsOnline
    • useIsTextTruncated
    • useIsomorphicEffect
    • useList
    • useLocalStorage
    • useMediaQuery
    • usePreferredLanguage
    • usePrevious
    • useQueue
    • useRenderCount
    • useResizeObserver
    • useScript
    • useScrollLock
    • useSessionStorage
    • useStep
    • useTimeoutFn
    • useToggle
    • useTouchScreenSwipe
    • useUnmount
    • useVisibilityChange
    • useWindowScroll

How to setup tests

Hooks marked with the icon comes with a test file that you can use to test the hook.

Tests are written with Vitest, and Testing Library

To run the tests, you need to install the vitest package and @testing-library/react package.

npm install --save-dev vitest @testing-library/react @testing-library/dom @types/react @types/react-dom

Then, configure Vitest using the Vitest guide.