grassrootsgrocery / admin-portal

GNU Affero General Public License v3.0
11 stars 6 forks source link

Don't destructure the return values of react query hooks in frontend #67

Closed jasoncavanaugh closed 1 year ago

jasoncavanaugh commented 1 year ago

In many places in the frontend, we have code that looks like

const { data: driversData, status: driversStatus, error: driversError } = useQuery(...);

I think this should be changed to something more like

const driversQuery = useQuery(...);

and then you would access the properties like normal, i.e.

driversQuery.data; //drivers
driversQuery.status; //query status
driversQuery.error; //thrown errors