[]previous and next page

useRevalidator

The page's revalidator: state (idle or loading) and revalidate(), which refreshes the loader data of the current location.

The page's revalidator: state (idle or loading) and revalidate(), which refreshes the loader data of the current location.

Import#

ts
import { useRevalidator } from "@shadow-js/dusk/client";

Signature#

ts
function useRevalidator(): Revalidator

Returns#

The revalidator.

Examples#

ts
const revalidator = useRevalidator();
<button onClick={() => revalidator.revalidate()}>{revalidator.state() === "loading" ? "Refreshing" : "Refresh"}</button>