React Hooks

The React snippet collection contains function components and reusable hooks for React 16.

  • useOnWindowScroll

    React, Hooks

    Executes a callback whenever the window is scrolled.

  • usePortal

    React, Hooks

    Creates a portal, allowing rendering of children outside the parent component.

  • useOnWindowResize

    React, Hooks

    Executes a callback whenever the window is resized.

  • useLocalStorage

    React, Hooks

    Creates a stateful value that is persisted to localStorage, and a function to update it.

  • Runs an animating function, calling it before every repaint.

  • useSessionStorage

    React, Hooks

    Creates a stateful value that is persisted to sessionStorage, and a function to update it.

  • useUnload

    React, Hooks

    Handles the beforeunload window event.

  • useDebounce

    React, Hooks

    Debounces the given value.

  • useMergeState

    React, Hooks

    Creates a stateful value, and a function to update it by merging the new state provided.

  • useClickInside

    React, Hooks

    Handles the event of clicking inside the wrapped component.

  • useClickOutside

    React, Hooks

    Handles the event of clicking outside of the wrapped component.

  • Executes a callback immediately after a component is updated.

  • useDelayedState

    React, Hooks

    Delays creating a stateful value until some condition is met.

  • useEventListener

    React, Hooks

    Adds an event listener for the specified event type on the given element.

  • useMap

    React, Hooks

    Creates a stateful Map object, and a set of functions to manipulate it.