【发布时间】:2020-05-02 12:51:54
【问题描述】:
我正在尝试创建一个使用 useQuery 导出功能的包
但是我得到以下错误:
Could not find "client" in the context or passed in as an option. Wrap the root component in an <ApolloProvider>, or pass an ApolloClient instance in via options.
这甚至是最简单的示例,它只导出 useQuery(obvs 实际代码不止于此)
我知道我的代码没问题,否则就像我使用导入 useQuery 一样
import { useQuery } from '@apollo/react-hooks'
效果很好
简单的例子在这里..
【问题讨论】:
标签: react-apollo rollupjs react-apollo-hooks