gom*_*mbo 4 apollo reactjs graphql react-hooks
我目前正在尝试使用 useEffect 挂钩中 apollo v3 的 useSubscription 挂钩来更新 GraphQL 订阅:
let containerSubscription = useSubscription<CreatedDateSubscription, CreatedDateSubscriptionVariables>(
gql(containerUpdatedOnCreatedDate),
{
variables: { createdDate: selectedDate },
shouldResubscribe: true, // is this needed?
},
);
// update subscription on date change
React.useEffect(() => {
// how do I update the subscription here?
// setting containerSubscription.variables = ... does not change the subscription
}, [selectedDate]);
Run Code Online (Sandbox Code Playgroud)
我在阿波罗文档中找不到有关如何解决此问题的任何解决方案。
任何帮助,将不胜感激!
| 归档时间: |
|
| 查看次数: |
2161 次 |
| 最近记录: |