Function useActualState

Returns an array of values representing the current state and a function to update the state.

  • Type Parameters

    • S = undefined

      The type of the state.

    Parameters

    • OptionalinitialState: S | (() => S)

      Optional initial state.

    Returns readonly [MutableRefObject<S>, Dispatch<SetStateAction<S>>]

    • An array containing the mutable reference to the state and the state update function .