{"repo":"nanostores/query","free":true,"listed":false,"github":"https://github.com/nanostores/query","clone":"git clone https://github.com/nanostores/query.git","description":"⚡️ Powerful data fetching library for Nano Stores. TS/JS. Framework agnostic.","language":"TypeScript","stars":337,"topics":["async","cache","fetch","graphql","nano","query","stale","stale-while-revalidate"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Nano Stores Query A tiny data fetcher for Nano Stores. - Small . Less than 2 Kb (minified and gzipped). - Familiar DX . If you've used swr or react-query , you'll get the same treatment, but for 10-20% of the size. - Built-in cache . stale-while-revalidate caching from HTTP RFC 5861. User rarely sees unnecessary loaders or stale data. - Revalidate cache . Automatically revalidate on interval, refocus, network recovery. Or just revalidate it manually. - Nano Stores first . Finally, fetching logic outside of components. Plays nicely with store events, computed stores, router, and the rest. - Transport agnostic . Use GraphQL, REST codegen, plain fetch or anything, that returns Promises (Web Workers, SubtleCrypto, calls to WASM, etc.). Install Usage See Nano Stores docs about using the store and subscribing to store’s changes in UI frameworks. Context First, we define the context. It allows us to share the default fetcher implementation and general settings between all fetcher stores, and allows for simple mocking in tests and stories. Second, we create the fetcher store. createFetcherStore returns the usual atom() from Nano Stores, that is reactively connected to all stores passed as keys. Whenever the $currentPostId updates, $currentPost will call the fetcher once again. Third, just use it in your components. createFetcherStore returns the usual atom() from Nano Stores. Note: before any component subscribes to the store, its value is { loading: false } with no data or error . O","default_branch":null,"files":null,"tree":[],"storefront":"/r/nanostores","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nanostores/query/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}