So i have a page with 4 tabs that users can click, on each tab click this needs to trigger different useLazyQueries for my graphql react app. All 4 queries have data that will be displayed with the same columns so i am trying to avoid making 4 different components for each tab.
Is it possible to do something like this:
// DATA FETCH FOR RAW MATERIALS & PACKAGING
const [getData, { data, error, refetch, loading }] = () => {
switch (listType) {
case "List One": {
useLazyQueryOne({
variables: {}
})
}
case "List Two": {
useLazyQueryTw-o({
variables: {}
})
}
...
}
}