Migration
Manage state during migration
Choose one state owner during coexistence and define how React Native and Compose read and update it.
On this page
Keep one owner#
When several React Native screens share a store, keep the store in place for the first Compose slice. Have the React Native route pass the data as typed props and route requests to change it through callbacks. This keeps both versions consistent while a rollout flag switches between them.
When only the migrated screen owns the state, a Kotlin ViewModel can own it and expose StateFlow to Compose. Keep navigation inputs and actions at the route boundary. RN2KMP does not currently generate React hooks for Kotlin Flow. For a React Native screen that consumes a Kotlin operation, use the generated function API and retain the current React Native state owner until there is an explicit state migration.
Verify the handoff#
Exercise loading, edits, retries, back navigation and reopening. With a rollback switch, verify both versions can read data written by the other. If state is persisted, plan the storage migration and verify an update from a previously installed app.