GraphiQL API Documentation
    Preparing search index...

    Function useOptimisticState

    • Implements an optimistic caching strategy around a useState-like hook in order to prevent loss of updates when the hook has an internal delay and the update function is called again before the updated state is sent out.

      Use this as a wrapper around useOperationsEditorState, useVariablesEditorState, or useHeadersEditorState if you anticipate calling them with great frequency (due to, for instance, mouse, keyboard, or network events).

      Parameters

      • __namedParameters: [string, (val: string) => void]

      Returns [string, (val: string) => void]

      const [operationsString, handleEditOperations] =
      useOptimisticState(useOperationsEditorState());