在我使用Apollo2的项目中,我像这样导入了react-apollo依赖项:import { QueryProps } from "react-apollo"。
现在在Apollo3中,我在@apollo/client中找不到react,我在Apollo的documentation中用typescript看到,它像这样导入的节点模块‘“../ QueryProps _QueryProps/@ apollo /react-hoc”’没有导出的成员‘QueryProps’.‘。
那么如何将QueryProps依赖项导入到Apollo3中?
发布于 2021-05-19 03:59:17
您可以单独调用这些类型,而无需使用QueryProps。例如:
import { DocumentNode, OperationVariables, WatchQueryFetchPolicy } from '@apollo/client'之前:
type Props = {
...
query: QueryProps
}之后:
type Props = {
...
query: {
query: DocumentNode
fetchPolicy: WatchQueryFetchPolicy | undefined
variables: OperationVariables | undefined
}
}https://stackoverflow.com/questions/66913898
复制相似问题