use-promise
fetch
use-promise | fetch | |
---|---|---|
4 | 4 | |
10 | 58 | |
- | - | |
0.0 | 6.7 | |
4 months ago | 10 months ago | |
TypeScript | TypeScript | |
Mozilla Public License 2.0 | MIT License |
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.
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
fetch
-
Modern API data-fetching methods in React
I've written a very small fetch wrapper that simplifies the syntax: https://github.com/tkrotoff/fetch
-
I wrote a small Fetch API wrapper, comes with testing utilities
See https://github.com/tkrotoff/fetch/tree/file-organization/src
What are some alternatives?
react-firebase-hooks - React Hooks for Firebase.
ky - 🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
reactfire - Hooks, Context Providers, and Components that make it easy to interact with Firebase.
window.fetch polyfill - A window.fetch JavaScript polyfill.
formik - Build forms in React, without the tears 😭 [Moved to: https://github.com/formium/formik]
cross-fetch - Universal WHATWG Fetch API for Node, Browsers and React Native.
redaxios - The Axios API, as an 800 byte Fetch wrapper.
node-fetch - A light-weight module that brings the Fetch API to Node.js
react-hook-form - 📋 React Hooks for form state management and validation (Web + React Native)
scarlett - A strongly typed, TypeScript powered, with zero dependencies, rest client library based on Fetch API