DEV Community


Discussion on: remember { mutableStateOf() } – A cheat sheet

zachklipp profile image
Zach Klippenstein Author

Nope, that still works. Reads are tracked by actual calls to the getter of a State.value, no matter where or how it is called. Also, there’s no compiler magic here. I believe under the hood there is actually a thread local installed that points to the current snapshot and reads record themselves there. So it doesn’t matter what your call stack looks like.

louiscad profile image
Louis CAD

Oh, that's very neat!
Thanks for the info. I hope this knowledge makes it into the official docs.