Skip to Content
CrowCrow

Coming from Jetpack Compose

Mental-model translation and side-by-side API guide for Jetpack Compose developers moving to Crow.

If you already know Jetpack Compose, you can read and write Crow in minutes. Crow intentionally keeps Compose's authoring vocabulary (Column, Row, Box, Modifier, LazyColumn, MaterialTheme) while replacing the execution model underneath.

The One Mental-Model Shift

In Jetpack Compose, a @Composable function is a template that re-executes whenever state it reads changes. Every remember, derivedStateOf, LaunchedEffect, stability annotation, and deferred-lambda trick exists to work around function re-execution.

In Crow, a @Ui function is a setup block that runs once.

ConceptJetpack ComposeCrow
Component declaration@Composable fun Card(...)@Ui fun Card(...)
Local statevar n by remember { mutableIntStateOf(0) }var n by signal(0)
Survives process deathvar q by rememberSaveable { mutableStateOf("") }var q by saved("")
Derived stateval doubled by remember { derivedStateOf { n * 2 } }val doubled by { n * 2 }
Side effectsLaunchedEffect(key) { ... } / DisposableEffecteffect({ key }) { v, prev -> onCleanup { ... } }
Conditional UIPlain if (cond) (re-runs whole scope)Reactive if (cond) (lowered to a scoped region)
Keyed listsitems(list, key = { it.id }) / forEachFor(list, key = { it.id }) / LazyColumn
Static prop hint@Immutable / @Stable annotations@Once on props that never change
CompositionLocalcompositionLocalOf { ... }contextOf(...) (owner-tree scoped)
Async loadingManual UiState sealed class + ViewModelresource / crow-query + Loading / Errored

Why remember Disappears

Because @Ui functions run once, local variables already live for the lifetime of the component instance. You never wrap signals, controllers, or lambdas in remember { ... }.

@Ui
fun SearchBar(@Once onSearch: (String) -> Unit) {
    val query = saved("")
    val trimmed by { query.value.trim() }
    val canSubmit by { trimmed.isNotEmpty() }

    Row(Modifier.fillMaxWidth().padding(16.dp)) {
        OutlinedTextField(
            value = query,
            placeholder = { Text("Search...") },
            modifier = Modifier.weight(1f),
        )
        Button(
            onClick = { onSearch(trimmed) },
            enabled = canSubmit,
        ) {
            Text("Go")
        }
    }
}

The Compiler Has Your Back

The single mistake Compose developers make on day one is writing a plain val that reads a signal:

var count by signal(0)
val doubled = count * 2 // ❌ Compile Error CR1001!

Because the body runs once, val doubled = count * 2 would freeze 0 forever. Crow's K2 FIR checker catches this at compile time (CR1001) and tells you to write either:

  • val doubled by { count * 2 } — reactive derived value
  • val initial = untrack { count * 2 } — explicit one-time snapshot

Similarly, mutating a signal directly inside a @Ui body is caught at compile time (CR1002).

Greenfield Android, Native Escape Hatch

Crow is built for greenfield Android apps that want zero recomposition, zero ViewModel ceremony, and zero AndroidX glue. When you need a legacy Android View (such as a WebView, SurfaceView, or third-party SDK view), embed it directly in any Crow layout with NativeView from crow-ui.

How is this guide?

On this page