use query hook react Apollo conditional call
You should use skip
option:
If skip is true, the query will be skipped entirely.
const isBroncos = getCondition();const App = () => { const [player, setPlayer] = React.useState(false); const { data } = useQuery(GetBroncosPlayersQueryDocument, { variables: { player }, skip: isBroncos }); return !isBroncos && data && <>...</>;};