You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm imagining something similar to what Theo did with Stripe Theo's recommendations, only let's get advice from as many people as possible. Here are three things I would love to know how others handle:
The fetcher function
Official typed fetcher function? const fetcher = (...args) => fetch(...args).then(res => res.json()). This but then properly typed on the docs page.
Is it recommended in SWR to just have a single global fetcher function that is controlled by the args parameter? For example, what if you want to add headers, change the method to post and add a body? Should you define a new fetcher function or just use the args to adjust? Seems to suggest creating a new fetcher
Official way to make a reusable request abortable?
Handling a SELECT statement that has many parameters
In a few places in my app, I need to collect information from the user (such as filters, pagination, and an input field), which gets used to create an SQL query on the backend. Is it better in this situation to pass all that information as query parameters or use the trigger function returned by the useSWRMutation hook?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm imagining something similar to what Theo did with Stripe Theo's recommendations, only let's get advice from as many people as possible. Here are three things I would love to know how others handle:
The fetcher function
Handling a SELECT statement that has many parameters
In a few places in my app, I need to collect information from the user (such as filters, pagination, and an input field), which gets used to create an SQL query on the backend. Is it better in this situation to pass all that information as query parameters or use the trigger function returned by the useSWRMutation hook?
Beta Was this translation helpful? Give feedback.
All reactions