State Management · Junior · Question 62 of 75

Which fields of a useQuery result do you usually render from?

const { data, error, isPending, isError } = useQuery({ queryKey: ["todos"], queryFn });

Explanation

status is 'pending' | 'error' | 'success'. Checking it first lets TypeScript narrow data to a defined value in the success branch.

Further reading

Problem with a question

State Management · Junior · question 62

Test yourself

Take the State Management · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz