A group of react hooks that makes life easier.
npm install @ayonli/react-hooksA group of react hooks that makes life easier.
This package currently include the following hooks, more hooks may be added in
the future.
- useAsyncData
Asynchronously load remote data, usually used with {@link fetch} API.
- useDebouncedCallback
Returns a debounced function that can be used to reduce unnecessary calls.
- usePropState Uses a
prop as the state in a component, and when the prop changes, the state will
change accordingly.
- useRerender Returns a
rerender function that can be used to trigger a rerender of the component
manually.
- useRevertibleState
Adds additional functions to the useState hook, allowing us to undo and redo
state changes.
- useRouter Manipulates
route and retrieving route parameters.
- useSubmit Submit data to
a remote server and track the status of the request.
- useStorageState
Similar to useState, but persist the state to the localStorage (by default)
or sessionStorage.
- useUrlState Similar to
useState, but persist the state to the URL query parameters.