https://kotlinlang.org logo
#compose
Title
# compose
t

theapache64

02/14/2022, 3:11 PM
Can anyone show me the difference between
compositionLocal
vs
staticCompositionLocal
with a code snippet and output ?
👀 1
n

Nathaniel Rowe

02/14/2022, 4:27 PM
https://developer.android.com/jetpack/compose/compositionlocal#creating-apis If the value of a static composition local updates, then everything in the content lambda where you call CompositionLocalProvides gets recomposed. If the value of a composition local updates, then compose will only recompose the parts that actually read the current value. So then, why would you ever want to use static composition local? The docs say that if the value is something that is really unlikely to ever change, then its better to use static composition local performance-wise.
🔥 2
🙏 2
21 Views