Apollo useSubscription React hook
将实时数据带入您的用户界面的最容易的方式,是使用 Apollo React-Hook 的 useSubscription React hook。这让您可以在组件的呈现函数中直接呈现来自服务的数据流!需要注意的是,订阅只是监听器,它们在第一次连接时不会请求任何数据,只会打开连接以获得新的数据。
Did you find this page helpful?
Start with GraphQL on Hasura for Free
Build apps and APIs 10x faster
Built-in authorization and caching
8x more performant than hand-rolled APIs
![Promo](/learn/zh/graphql/react/static/hasura-free-ff60e409244e0ea12b5a3045d1a9096b.png)
![footer illustration](https://graphql-engine-cdn.hasura.io/learn-hasura/assets/footer-img.png)