API responses typically have metadata and nested data. You'll use optional chaining and destructuring to extract what you need.
const response = {
status: 200,
data: {
users: [{ id: 1, name: "Alice" }]
}
};
const users = response?.data?.users ?? [];
const [firstUser] = users;
This safely handles missing data at any level.