anzol
TypeScript icon, indicating that this package has built-in type declarations

4.1.0 • Public • Published

NPM Package MIT License Type Definitions Code Coverage NPM Downloads

Anzol provides very useful client-side React hooks for very common tasks such as data fetching or deferring the updating of values with a custom timeout. It supports both SSG and SSR. You can find working examples in the documentation or, if you just want the code, in the examples/components directory.

Features:

  • ✅ Fully Tested
  • ✅ SSR and SSG compatible
  • ✅ Detailed documentation

Installation

Anzol is available on the NPM registry. To install it, just run:

npm install anzol

Currently Available Hooks

  • useFetch: Fetches the provided URL and optionally parses the response. Aborts requests when a new request is started before the previous has finished to prevent flickering of stale responses by default.
  • useDefer: Delays the update of a value until the input has stopped changing for a certain time. This is different from React's built-in useDeferredValue because you can set the delay yourself.
  • useFirstRender: Returns true on first render; false otherwise.
  • useToggle: Provides a boolean toggle that does not persist between page reloads.
  • useIntersectionObserver: Provides a hook API that wraps the IntersectionObserver API. This hook is for use with a single element only. For simplicity this is the recommended approach. If you have an extremely large number of objects to observe and want to avoid creating an IntersectionObserver for each, refer to useIntersectionObserverArray to use a single observer for multiple elements with a common root.
  • useIntersectionObserverArray: Like useIntersectionObserver but for multiple elements.
  • useEvent: Provides a wrapper around the EventListener API. Use the return value to define the event target.
  • useLazyLoad: Provides a simple API for fetching data from a resource in batches.
  • useLocalStorage: Provides access to local storage, with the additional option to update all usages of this hook when local storage changes.
  • useClickOutside: Provides a ref to attach to an HTML element and takes a callback function, and calls that function when the user clicks anywhere outside the given element.
  • usePreferredScheme: Listens for changes in the user's preferred scheme and returns it.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.1.0
0latest

Version History

VersionDownloads (Last 7 Days)Published
4.1.0
0
4.0.1
0
4.0.0
0
3.0.2
0
3.0.1
0
3.0.0
0
2.6.1
0
2.6.0
0
2.5.2
0
2.5.1
0
2.5.0
0
2.4.0
0
2.3.0
0
2.2.0
0
2.1.12
0
2.1.10
0
2.1.9
0
2.1.8
0
2.1.7
0
2.1.6
0
2.1.5
0
2.1.4
0
2.1.3
0
2.1.2
0
2.1.1
0
2.1.0
0
2.0.0
0
1.2.0
0
1.0.80

Package Sidebar

Install

npm i anzol

Weekly Downloads

0

Version

4.1.0

License

MIT

Unpacked Size

105 kB

Total Files

8

Last publish

Collaborators

  • konstantin-lukas