imp*_*tle 6 typescript reactjs trpc.io
我正在使用 React Typescript,并且按照tRPC 文档进行服务器/客户端设置,但出现此错误。有谁知道为什么部署时会发生这种情况?我在本地使用的时候效果还好吗?
\n8:41:46 AM: TS2339: Property \'createClient\' does not exist on type \'"useContext collides with a built-in method, you should rename this router or procedure on your backend" | "Provider collides with a built-in method, you should rename this router or procedure on your backend" | "createClient collides with a built-in method, you should rename this router or procedure on your backend...\'.\n8:41:46 AM: Property \'createClient\' does not exist on type \'"useContext collides with a built-in method, you should rename this router or procedure on your backend"\'.\n8:41:46 AM: 42 | const [queryClient] = useState(() => new QueryClient());\n8:41:46 AM: 43 | const [trpcClient] = useState(() =>\n8:41:46 AM: > 44 | trpc.createClient({\n8:41:46 AM: | ^^^^^^^^^^^^\n8:41:46 AM: 45 | links: [\n8:41:46 AM: 46 | httpBatchLink({\n8:41:46 AM: 47 | url: `${process.env.REACT_APP_BACKEND_URL}/trpc`,\n8:41:46 AM: \xe2\x80\x8b\n8:41:46 AM: "build.command" failed \nRun Code Online (Sandbox Code Playgroud)\n我的应用程序.tsx
\nexport default function App() {\n const [queryClient] = useState(() => new QueryClient());\n const [trpcClient] = useState(() =>\n trpc.createClient({\n links: [\n httpBatchLink({\n url: `${process.env.REACT_APP_BACKEND_URL}/trpc`,\n }),\n ],\n })\n );\n\n return (\n <trpc.Provider client={trpcClient} queryClient={queryClient}>\n <QueryClientProvider client={queryClient}> \n........... rest of code here\n\n\n\n \nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
2130 次 |
| 最近记录: |