-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using promises to fetch #1
Comments
Hey @BigBaIIs, Possibly a good idea, give it a shot. Create a pull request, and I'll merge the PR and we'll test it! Always room for improvement. Theoretically speaking we could add: const response = await axios.get('https://doge.gov/api/kpis/Federal_Government');
setFedData(response.data);` If we used new Promise((resolve) => {
setTimeout(() => {
resolve({
"aggregated": {
"age_20_24_count": 52292, Probably a good starting point is to try with npm install axios In the root directory, then import it via: import axios from 'axios'; This then would use |
i agree @Montana, axios seems like a good starting point, as promises offer a bit more dynamic and flexible approach to handling asynchronous operations. with axios, you get a clean, promise-based HTTP client that simplifies making requests and managing responses, which can be especially handy when dealing with APIs or fetching data in a modern JS in this case react env. |
Axios based promises structure pairs nicely with hooks like React Query would give us things like automatic refetching, stale-while-revalidate caching, and built-in loading/error states, so we can focus more on building features and less on wrangling data. What do you think about pairing it with |
great work guys! this is an awesome tool |
found that axios works better |
i think using axios or promises might be best way to fetch, as when I run
curl -X GET
:but beautiful way of displaying the data @Montana, will push some updates for promises/axios
The text was updated successfully, but these errors were encountered: