TanStackT
TanStack2y ago
1 reply
capable-brown

204s - Null Or Undefined

When accessing via axios., a rest resource that could return an object or a 204 - no content.
Is it better practice directly return the undefined from res?.data or manipulate that into a null for the consumer of the useQuery inside the queryFN.
i.e should the type be ResponseObject | undefined or ResponseObject | null.
return res?.data or return res?.data ?? null
Was this page helpful?