1.0.0 • Published 3 years ago
@stein197/rehook v1.0.0
Rehook
A collection of React hooks.
Installation
npm install @stein197/rehookHooks
useAsync()
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>;useBoolean()
Creates a boolean that can be toggled, switched, set.
function useBoolean(init: boolean): UseBooleanReturn;useForce()
Forces rerender.
function useForce(): () => void;usePrevious()
Saves the previous value.
function usePrevious<T>(value: T): T;useImage()
Loads an image.
function useImage(url: string): UseResourceReturn;useScript()
Loads a script.
function useScript(url: string): UseResourceReturn;useStylesheet()
Loads a stylesheet.
function useStylesheet(url: string): UseResourceReturn;NPM script
clean. Delete all generated filesbuild. Build the projecttest. Run unit tests
1.0.0
3 years ago