Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hazae41/glacier

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hazae41/glacier

Yet another React data (re)fetching library

  • 2.0.0-110
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
441
decreased by-20.83%
Maintainers
1
Weekly downloads
 
Created
Source
npm i @hazae41/glacier

Node Package 📦Read the docs 📚Next.js Example 🪣Expo Example 🪣Comparison with other libs 🌐

Philosophy 🧠

Glacier uses two new approaches compared to other data fetching libraries like swr or react-query:

  1. Encapsulating key+fetcher+params in a single abstraction called schema.
  2. Composing features with very simple hooks instead of having bloated configuration and unexpected behaviors.
function useAutoFetchMixture(query: Query) {
  useFetch(query) // Fetch on mount and url change
  useVisible(query) // Fetch when the page is focused
  useOnline(query) // Fetch when the browser is online
}

function useHelloWithAutoFetch() {
  const query = useQuery(createHelloQuery, [])
  useAutoFetchMixture(query)
  return query
}

function MyApp() {
  const { data, error } = useHelloWithAutoFetch()

  if (error != null)
    return <MyError error={error} />
  if (data == null)
    return <MyLoading />
  return <MyPage data={data} />
}

Features 🔥

  • 100% TypeScript and ESM
  • No external dependency
  • Composition-based hooks
  • Rust-like patterns
  • Transport agnostic (REST, GraphQL, WebSocket)
  • Storage agnostic (IndexedDB, localStorage)
  • Works in a Service Worker or in a serverless function
  • Per-query, encrypted, garbage-collected, persistent storage
  • Store normalization and indexes
  • Concurrent and multi-step optimistic states
  • Request deduplication, cooldown, timeout, cancellation, expiration, and retrying
  • Automatic refetching based on various signals
  • Page-based and cursor-based pagination
  • SSR & ISR support
  • React Suspense support
  • React Native support

Keywords

FAQs

Package last updated on 30 Nov 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc