DEV Community

Discussion on: Plumbing data with derived state in Compose

Collapse
 
zachklipp profile image
Zach Klippenstein

State tracking works when reads are initiated from @Composable functions (not from e.g. onClick callbacks) and propagates through functions and computed properties, but not regular properties (e.g. adding backing field to _result in your From push to pull example breaks tracking).

Otherwise it's just a one-time read.

Is that understanding correct?

Yes.

Looks convenient, but IMHO makes it harder to reason about code behavior.

That can be true, there are definitely trade offs to this vs expressing reactivity in your types.