A collection of React hooks.
npm install @stein197/rehook
Awaits for the promise to resolve.
function useAsync<T, U>(promise: Promise<T>): UsePromise<T, U, false>;
Gets a function that must return a promise and calls it on demand, which starts the process of resolving the promise.
function useAsync<T, U>(cb: () => Promise<T>): UsePromise<T, U, true>;
Creates a boolean that can be toggled, switched, set.
function useBoolean(init: boolean): UseBooleanReturn;
Forces rerender.
function useForce(): () => void;
Saves the previous value.
function usePrevious<T>(value: T): T;
Loads an image.
function useImage(url: string): UseResourceReturn;
Loads a script.
function useScript(url: string): UseResourceReturn;
Loads a stylesheet.
function useStylesheet(url: string): UseResourceReturn;
clean
. Delete all generated filesbuild
. Build the projecttest
. Run unit tests