Skip to main content

Interface: UseNowOptions

Defined in: use-now.ts:4

Options for useNow.

Properties​

enabled?​

optional enabled?: boolean

Defined in: use-now.ts:16

Set to false to stop updating. The hook then returns the last value it returned while enabled, or the time of its first render if it starts disabled. Default is true.


intervalMs?​

optional intervalMs?: number

Defined in: use-now.ts:10

How often, in milliseconds, the time is refreshed. A value that is not a finite, positive number falls back to the default, and values above 2147483647 are capped. Default is 1000.


pauseWhenHidden?​

optional pauseWhenHidden?: boolean

Defined in: use-now.ts:22

Stop ticking while the document is hidden, and refresh as soon as it is visible again. Consumers with different values use separate timers. Default is true.


serverNow?​

optional serverNow?: number

Defined in: use-now.ts:28

The time, in milliseconds since the epoch, to return on the server and while hydrating. Pass a timestamp serialized by the server to get identical markup on both sides. Default is the current time.