React Hookers - v6.3.0
    Preparing search index...

    Function useDebouncedState

    • Returns stateful values and a function to update them. Upon invocation of setState, the nextState is assigned synchronously, and the component is re-rendered. After the ms the currState is set to nextState and component is re-rendered again.

      Type Parameters

      • T

        A stateful value.

      Parameters

      • ms: number

        A delay after which currState is synchronized with nextState.

      • initialValue: T | (() => T)

        An initial value or a callback that returns an initial state.

      Returns DebouncedStateProtocol<T>

    • Returns stateful values and a function to update them. Upon invocation of setState, the nextState is assigned synchronously, and the component is re-rendered. After the ms the currState is set to nextState and component is re-rendered again.

      Type Parameters

      • T = undefined

        A stateful value.

      Parameters

      • ms: number

        A delay after which currState is synchronized with nextState.

      Returns DebouncedStateProtocol<undefined | T>