Mat*_*att 2 typescript apollo reactjs strapi next.js
我对 NextJS 和 Typescript 相当陌生,并且我\xe2\x80\x99m 实现了无头 CMS Strapi,但在使用 Apollo 时遇到了问题。我整个周末都在谷歌上搜索xe2x80x99,试图更好地理解这个问题。我希望有人能在这里帮助我。
\n\n在我的中收到以下错误_app.tsx
Property \'apollo\' does not exist on type \'AppPropsType<Router, {}>\'.\nRun Code Online (Sandbox Code Playgroud)\n\n我的下面的函数发生了错误MyApp。
_app.tsximport * as React from \'react\'\nimport { AppProps } from \'next/app\'\nimport { ApolloProvider } from \'@apollo/react-hooks\'\nimport withData from \'../../utils/apollo\'\n\nimport \'circular-std\'\nimport \'react-multi-carousel/lib/styles.css\'\nimport \'../scss/styles.scss\'\n\nfunction MyApp({ Component, pageProps, apollo }: AppProps) {\n return (\n <ApolloProvider client={apollo}>\n <Component {...pageProps} />\n </ApolloProvider>\n )\n}\n\nexport default withData(MyApp)\nRun Code Online (Sandbox Code Playgroud)\n\n相应的Strapi 设置教程位于前端设置第 3 部分。
\n或者,我已经执行了以下操作:
import App, { AppProps } from 'next/app';
import { ApolloProvider, ApolloClient } from '@apollo/client';
interface Props {
apollo: ApolloClient<{}>;
}
const MyApp = ({ Component, pageProps, apollo }: AppProps & Props) => {
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3504 次 |
| 最近记录: |