🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@data-client/hooks

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@data-client/hooks

Collection of composable data hooks

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
162
95.18%
Maintainers
0
Weekly downloads
 
Created
Source

Networking Hooks

CircleCI Coverage Status npm downloads bundle size npm version PRs Welcome

Composable hooks for networking data

🚨 Repository Deprecated and Moved! 🚨

This repository has been deprecated and is no longer actively maintained. All hooks moved to @data-client/react

useCancelling()

Aborts inflight request if the parameters change.

const data = useSuspense(useCancelling(MyEndpoint, { filter }), { filter });

useDebounce()

Delays updating the parameters by debouncing. Useful to avoid spamming network requests when parameters might change quickly (like a typeahead field).

const debouncedFilter = useDebounce(filter, 200);
const data = useSuspense(SearchList, { filter: debouncedFilter });

useLoading()

Helps track loading state of imperative async functions.

function Button({ onClick, children, ...props }) {
  const [clickHandler, loading, error] = useLoading(onClick);
  return (
    <button onClick={clickHandler} {...props}>
      {loading ? 'Loading...' : children}
    </button>
  );
}

Keywords

hooks

FAQs

Package last updated on 20 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts