【发布时间】:2021-10-05 04:29:13
【问题描述】:
我需要显示来自 apollo 的错误。我想知道为什么如果我 console.log 它会显示Error: undefined at new ApolloError
const {
error,
loading,
refetch,
data: { findOrders: { orders } = {} } = {},
} = useQuery(FIND_ORDERS, {
notifyOnNetworkStatusChange: true,
fetchPolicy: "no-cache",
variables: {
fromDate: "date here",
toDate: "date here",
},
});
if (error) {
console.error(error);
return <div>Error!</div>;
}
【问题讨论】:
标签: reactjs react-hooks apollo apollo-client