Cannot read properties of undefined (reading 'createTRPCReact')

I'm trying to use it in an Astro project. https://github.com/Industrial/test-astro-solid/blob/main/src/lib/trpc.ts I think I implemented it as per the example https://trpc.io/docs/react#2-create-trpc-hooks
GitHub
test-astro-solid/trpc.ts at main · Industrial/test-astro-solid
Contribute to Industrial/test-astro-solid development by creating an account on GitHub.
Usage with React | tRPC
How to use and setup tRPC in React
B
backbone402d ago
I don't know why.but please try pnpm install again or restart VSCode.
I
Industrial402d ago
@backbone I did rm -rf node_modules && pnpm install and same thing @backbone could you run git clone git@github.com:Industrial/test-astro-solid.git && cd test-astro-solid && pnpm i && pnpm dev to reproduce ?
B
backbone402d ago
Sorry, I would try this repo
I
Industrial402d ago
Thank you 🙂 I got it! I'm using SolidJS and not React so I don't need react-query.
import { createResource } from 'solid-js'
import type { JSX } from 'solid-js/jsx-runtime'

import { trpc } from '@/lib/trpc'

export const Test = (): JSX.Element => {
const userId = '123'
const [user, { mutate, refetch }] = createResource(userId, async (id: string) => {
return await trpc.getUserById.query(id)
})
return <div>USER? {JSON.stringify(user())}</div>
}
import { createResource } from 'solid-js'
import type { JSX } from 'solid-js/jsx-runtime'

import { trpc } from '@/lib/trpc'

export const Test = (): JSX.Element => {
const userId = '123'
const [user, { mutate, refetch }] = createResource(userId, async (id: string) => {
return await trpc.getUserById.query(id)
})
return <div>USER? {JSON.stringify(user())}</div>
}
That's all you need 🙂
More Posts
application/octet-stream responseIm refactoring my old backend to trpc so far it was a pleasure and fairly straight forward process ❤Discriminated union handleHow Do I handle Input type if its discriminated union?? ``` export const batchTasksRouter = createHit external APIs ...I'm new to tRPC, I need to hit an external API (OpenAI) directly from the client-side. Can I still uCannot get subscription event to fireRipping my hair out here trying to get Websockets working with tRPC and Next. Everything seems to bHow to organise reusable functionsHow do you guys organize functions that all need the same context (usually from tRPC)? For example lHow to get response type depending on the input params?Simple example of a normal JS function with generics: ``` const example = <T extends unknown>(paramshow to build tRPC and Prisma with express?I am using TSC as the official docs example does. But when I use paths in tsconfig.json, It does notHow to infer types from input?When I call my procedure from the client I send an array of strings as an input. How can I infer theHow to infer types of a queryCoinsider the example `const hello = trpc.hello.useQuery();` I would like to export the type we get Data Visualisation/Chartsis anyone using tRPC on data visualisation (say bar chart/line chart) in a scenario close to a bankitrpc + AWS Lambda (through cdk)Hi all, has anyone successfully integrated tRPC with AWS Lambda? My current stack is API Gateway + LIs it possible to narrow an output schema if the query optionally doesn't return all fields?I have a router procedure that has an input schema that has an optional `filter` that changes the shFetching different server url than defined in configIs it possible to access the reactQuery instance and fetch different server url? I would like to useinput using z.or not working properlyi have an input like this let input = z.object({ name: z.string().optional() }).or(z.object({ How can I disable batching with fastify adapter?I cant seem to find a way to disable batching for my server, and this link doesnt help me much httpsIssue with monorepo architecture ant tRPCHi, we had an issue with batched requests that if we batch some requests they produce a TRPCClientErUsing tRPC in CRON jobsHey everyone, this might be a very stupid question, but is it possible to use tRPC inside a CRON joasync createContext for Express AdapterBeen debugging an odd behavior for the past hour, it seems like that an async function does not work