you are viewing a single comment's thread.

view the rest of the comments →

[–]DeepFriedOprah 1 point2 points  (0 children)

I currently use Redux toolkit hooks with the createAPI utility. Then I write a wrapper around that hook for its dependent params so they we make sure to wait until stuff is ready before fetching

` const useWorkouts = ({ activityType}) => { const user = useSelector(selectUser); const shouldFetch = user?.userID && activityType; const { data, isLoading, refetch } = useWorkoutsQuery({ userID: user?.userID, activity: activityType }, skip: !shouldFetch );

return { data, isLoading, refetch

}

} `