Closed jkwan2011 closed 1 year ago
Starting a google sheet to compare API options https://docs.google.com/spreadsheets/d/1U8RnKo2cHlmG7Q6yCjSw3Qgd1t-uNCvvIvvm74XLk7s/edit?usp=sharing
Use Archive to retrieve archival weather (do not use for last 6-7 days of weather)
I know we rejected useFetcher
, but it might be a better solution than useLoader
(because of the complications in getting useLoader
to have multiple loaders) if we can use it right. GPT 3.5 has this to say about using useFetcher
that may be worth trying (though it says this isn't directly from Remix, so ~Y~OMMV):
To use useFetcher
to fetch data from an API without using it for a form, you can define a custom fetcher function and pass it to useFetcher
. Here's an example:
import { useFetcher } from "@remix-run/react";
const fetchData = async () => {
const response = await fetch("https://api.example.com/data");
const data = await response.json();
return data;
};
export function MyComponent() {
const fetcher = useFetcher(fetchData);
const { isLoading, error, data } = fetcher;
if (isLoading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {error.message}</p>;
}
return (
<div>
{/* Render the fetched data */}
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
);
}
Please note that the sources provided are not directly related to Remix, but they offer insights on using similar hooks and concepts in React applications.
We're using useLoader
for now.
We need to look up weather station data for the calculation of heat degree days. There are APIs online (e.g. https://www.degreedays.net) that might be able to help.