Hooks
/ API Reference
Hooks
/ API Reference

useRerender

A hook that rerenders the component after a given interval.

The Gist

'use client'
import { useRerender } from '@weser/hooks'

function Component() {
  useRerender(1000)

  return <div>Current time: {new Date().toLocaleTimeString()}</div>
}

Parameters

ParameterTypeDefaultDescription
intervalnumber?60000The interval in milliseconds.

Returns

(Date) A reference to the current date and time at the time of the last rerender.

On this page