Skip to main content
Version: 4.x.x

React Request Dependence

Dependent requests are needed when fetching some data from the server depends on other data that we need to receive first. This way we need to hold requesting until we get necessary data.


Example

import { getCurrentUser } from "api/users";
import { getUserProducts } from "api/products";

...

const { data: user } = useFetch(getCurrentUser)

const { data: products } = useFetch(getUser.setParams({ userId: user?.id }), {
disabled: !user
})