React Native Quickstart
This guide is for our new Kotlin Multiplatform SDK, which is in Public beta.
@stytch/react-native-consumer or @stytch/react-native-b2b.
Requirements:
- React Native 0.80.x or later
- React Native’s New Architecture (TurboModules) enabled
1. Install the SDK
2. Initialize the Client and Wrap Your App
Create the client once at the top level of your app and wrap your component tree withStytchProvider. The client is a singleton; calling createStytchConsumer again returns the same instance.
createStytchB2B, StytchClientConfiguration, and StytchB2BProvider from @stytch/react-native-b2b.
Your public token is in the Stytch Dashboard. Make sure you’ve also enabled the auth methods you want to use under SDK Configuration.
3. Access the Client and State in Components
useStytchUser() and useStytchSession() are convenient shortcuts that return the values directly from the authenticated state — they return undefined when the user is not logged in.
4. Auth Methods
All SDK methods areasync and throw on error. Wrap them in try/catch.