Skip to content
ReactQuery실무 경험

ReactQuery enabled (boolean): No API Call When id Is undefined or null

1 min readWorkMoved from my Tistory blogRead the Korean original

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

More in Work