flightcontrolhq / superjson

Safely serialize JavaScript expressions to a superset of JSON, which includes Dates, BigInts, and more.
https://www.flightcontrol.dev?ref=superjson
MIT License
4.02k stars 87 forks source link

[HELP] Using Superjson with React Native(Expo) & tRPC #192

Closed NoneWofie closed 2 years ago

NoneWofie commented 2 years ago

Hi, I'm trying to implement trpc into React Native and was adding superjson as a transformer. However I couldn't get it to work and can't find any online.

tRPC works, I can query my backend.

Problem image

Adding superjson to trpc client. image

package.json file { "name": "frontend", "version": "1.0.0", "main": "./src/App.tsx", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@trpc/client": "^9.25.3", "@trpc/react": "^9.25.3", "backend": "1.0.0", "expo": "~45.0.0", "expo-status-bar": "~1.3.0", "react": "17.0.2", "react-dom": "17.0.2", "react-native": "0.68.2", "react-native-web": "0.17.7", "react-query": "^3.39.1", "superjson": "^1.9.1" }, "devDependencies": { "@babel/core": "^7.12.9", "@types/react": "~17.0.21", "@types/react-native": "~0.66.13", "typescript": "~4.3.5" }, "private": true }

Skn0tt commented 2 years ago

I think this is a duplicate of https://github.com/blitz-js/superjson/issues/190#issuecomment-1139603553. Closing for now, feel free to re-open if that doesn't help.

NoneWofie commented 2 years ago

Hi, it works! thank you <3