React Native
Example: React Native
React Native is a framework combining native mobile app development with React. React Native can also be used with Convex!
Getting Started
You can create a new React Native app following the environment setup guide, which will end with creating a new project with
npx react-native init myapp
Then install the Convex client library and initialize a new project.
cd myapp
npm install convex
npx convex login
npx convex init
See quickstart for more on these steps.
Using Convex
You need a couple additional steps to get Convex working with React Native.
Add react-dom
and add react-native-get-random-values
via
these instructions
(to allow use of crypto
).
npm install react-dom
npm install react-native-get-random-values
myapp/index.js
import 'react-native-get-random-values';
Lastly, you should disable the unsaved changes warning when creating the Convex client, as it is not compatible with native apps:
myapp/App.jsx
const convex = new ConvexReactClient(process.env.REACT_APP_CONVEX_URL, {
// We need to disable this to be compatible with React Native
unsavedChangesWarning: false,
});