This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
calendar-demo/client/src/components/appointment/AppointmentList.js
2022-07-15 22:58:56 +02:00

42 lines
702 B
JavaScript

import React from 'react';
import Appointment from './Appointment';
import { useQuery, gql } from '@apollo/client';
export const APPOINTMENTS_QUERY = gql`
{
allAppointments{
_id
title
description
start
end
}
}
`;
const AppointmentList = () => {
const { data, loading } = useQuery(APPOINTMENTS_QUERY);
if (data !== undefined) {
return (
<div>
{
data.allAppointments.map((appointment) => (
<Appointment key={appointment._id} appointment={appointment} />
))
}
</div>
);
} else {
return (
<div>
Rendering...
</div>
)
}
};
export default AppointmentList;