@designerstrust/remix-utils
Version:
This package contains simple utility functions to use with [Remix.run](https://remix.run).
21 lines (20 loc) • 635 B
TypeScript
/**
* Trigger a refresh of the current routes loaders.
*
* This work by sending a `POST` request with a fetcher.submit to /dev/null in
* order to force loaders to run again.
*
* You need to create `app/routes/dev/null.ts` and define an action that
* returns null.
*
* It returns also a type and state strings with the process of the refresh.
*
* @example
* let { refresh } = useDataRefresh();
* return <button type="button" onClick={() => refresh}>Reload</button>;
*/
export declare function useDataRefresh(): {
refresh: () => void;
type: "init" | "refreshRedirect" | "refresh";
state: "idle" | "loading";
};