real-cancellable-promise
use-promise
Our great sponsors
real-cancellable-promise | use-promise | |
---|---|---|
2 | 4 | |
32 | 10 | |
- | - | |
3.2 | 0.0 | |
7 months ago | 3 months ago | |
TypeScript | TypeScript | |
MIT License | Mozilla Public License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
real-cancellable-promise
-
Are you sure you know Promises?
Even though #2 was the first and the result of #1 is ignored, #1 also ran to completion! In case process #1 must stop when process #2 "won" the race, then you need something like a cancellable promise! (There are other ways... You can do your own research by searching for "Why can't you cancel promises?").
-
Announcing real-cancellable-promise
Head on over to the README on GitHub for instructions on integrating your HTTP library with real-cancellable-promise and for more detailed examples.
use-promise
-
How do I convert Promise<string> object to string for use in href?
Shameless self plug for use-promise. This hook allows you to get the status and result of a Promise so you can use it in your component.
-
Modern API data-fetching methods in React
This is a very nice explainer on how to deal with the Fetch API! If you are looking for something that works even lower level using Promises (including cancellation when components un-mount or dependencies change) check out the library I wrote for the municipality of Amsterdam called use-promise.
-
How to replace useState with useRef and be a winner
Yes, in this case I simplified the code as the fetching logic is not the important piece of this code and would have only made the example more verbose than it needs to be. Normally I would use something like usePromise instead (shameless self promotion).
-
How to store previous value, in useAPI hook and call execute an api call when props change
I made a library just for that! https://github.com/Amsterdam/use-promise
What are some alternatives?
msn-weather - ☀ A simple MSN Weather API wrapper with built-in TypeScript support.
react-firebase-hooks - React Hooks for Firebase.
react-modal-promise - Ease way to use React modal components as Promise
reactfire - Hooks, Context Providers, and Components that make it easy to interact with Firebase.
rocketrpc - A typesafe framework to destroy client-server barriers.
formik - Build forms in React, without the tears 😭 [Moved to: https://github.com/formium/formik]
wretch - A tiny wrapper built around fetch with an intuitive syntax. :candy:
redaxios - The Axios API, as an 800 byte Fetch wrapper.
prray - "Promisified" Array, it compatible with the original Array but comes with async versions of native Array methods
fetch - A Fetch API wrapper
react-query - 🤖 Powerful asynchronous state management, server-state utilities and data fetching for TS/JS, React, Solid, Svelte and Vue. [Moved to: https://github.com/TanStack/query]
react-hook-form - 📋 React Hooks for form state management and validation (Web + React Native)