React Native
WunderGraph has official support for React Native. You can use the WunderGraph TypeScript client or SWR package to consume WunderGraph APIs in React Native.
Important
Package exports
React Native doesn't support the new Node.js exports field yet. Add this configuration in metro.config.js
to rewrite the paths and make sure WunderGraph is imported correctly.
Fetch Api
React Native doesn't fully support the fetch api and therefor isn't fully compatible with our TypeScript client at the moment. To get around this, you can install the following polyfill.
And import it somewhere in your project, for example in App.tsx
.
Subscriptions
Subscriptions aren't supported by default either, since web streams and SSE aren't supported in React Native. You can also install a polyfill for this to make it work. Please note this is still experimental and we would love to get your feedback on this.
And import it somewhere in your project, for example in App.tsx
.
Examples of using React Native with WunderGraph
If you've got any questions, please join our Discord Community and ask away.