nextjs-在事件中取代阿波罗查询
我有一个Apollo客户端,该客户端在getserversideprops
下被调用,
export const getServerSideProps: GetServerSideProps = async (context) => {
const { data } = await searchApolloClient.query({
query: LIST_QUERY,
variables: {
language: 'en',
},
});
return {
props: {
listProps: data,
},
};
};
现在我更改下拉选项时,我想将其ID作为此查询的变量传递给它,并在不刷新页面的情况下删除新结果。在阿波罗的文档中,我找到了 uselazyquery uselazyquery 在客户端可以正常工作。
我想知道是否有一种方法可以在服务器端本身上用新变量来灌输数据。
I have an Apollo Client which is called under the getServerSideProps
export const getServerSideProps: GetServerSideProps = async (context) => {
const { data } = await searchApolloClient.query({
query: LIST_QUERY,
variables: {
language: 'en',
},
});
return {
props: {
listProps: data,
},
};
};
Now when I change a dropdown option I want to pass it's id as a variable to this query and refetch the new results without refreshing the page. In Apollo's documentation I found the useLazyQuery which works fine on the client side.
I want to know if there is a way to refetch the data with new variables on the server-side itself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论