@posit-dev/shinyreact
    Preparing search index...

    Function useShinyInputValue

    • A read-only React hook that subscribes to a Shiny input value created by a separate producer component (typically one that calls useShinyInput and holds the setter).

      Use this when a component only needs to read an input value — it makes data flow direction visible at the call site and prevents accidental writes to inputs the component does not own.

      Mount ordering is handled: if this hook runs before the producer's useShinyInput effect attaches, the subscription is queued in the input registry and fires the moment the entry is created.

      Type Parameters

      • T

      Parameters

      • id: string

        The Shiny input ID to subscribe to (input$<id>).

      • options: { namespace?: string | null } = {}

        Optional configuration object.

        • Optionalnamespace?: string | null

          Module namespace to apply (or null to suppress the surrounding ShinyModuleProvider namespace).

      Returns T | undefined

      The current input value, or undefined if no producer has registered the ID yet.