Skip to content

ntcore-ts / @ntcore-ts/react / UseTopicOptions

Type Alias: UseTopicOptions<T>

UseTopicOptions<T> = object

Defined in: react/src/lib/use-topic.ts:18

Options for useTopic. Use publish: true to become the publisher with default properties (not retained). Use publish: { retained: true } (or other TopicProperties) to become the publisher with specific properties.

Type Parameters

T

T = NetworkTablesTypes

Properties

defaultValue?

optional defaultValue?: T

Defined in: react/src/lib/use-topic.ts:20

Shown before the first update.


publish?

optional publish?: true | TopicProperties

Defined in: react/src/lib/use-topic.ts:29

Make this client the publisher of the topic so you can write with setValue.

  • true → publish with default properties (not retained).
  • { retained: true } (or other TopicProperties) → publish with those properties. When provided, only call setValue after isReadyToWrite is true.

subscribeOptions?

optional subscribeOptions?: SubscribeOptions

Defined in: react/src/lib/use-topic.ts:22

Subscribe options (e.g. { periodic: 0.02 }).


unpublishOnUnmount?

optional unpublishOnUnmount?: boolean

Defined in: react/src/lib/use-topic.ts:34

When publish is set, call topic.unpublish() on unmount (default true). Set to false to keep publishing after the component unmounts.

Released under the MIT License.