ReactQuery enabled (boolean): No API Call When id Is undefined or null
js
const { data } = useQuery(
['todos', id],
() => fetchTodoById(id),
{
enabled: !!id,
}
);An option that skips the API call if the id value is undefined or null!
- #enabled
- #React Query