Suppose I have a composable that builds (and retur...
# compose
m
Suppose I have a composable that builds (and returns) a map containing a few images (values) obtained from assets (Android). Is it generally preferable to declare this composable as
@ReadOnlyComposable
or utilise
remember
in the implementation instead?
z
Not an exclusive choice. ReadOnlyComposable is an optimization for use in hot composables, it’s unlikely it would provide much benefit to you. Whether to make your composable stateful or stateless is the more interesting question, but there’s no way to answer that without knowing a lot more about your code/architecture, and even then it’s probably a pretty flexible choice.
👍 1
m
In my particular use case, I have some string resources that can embed drawables and image assets. I have some common code which will parse this text and build the corresponding map for the
Text
composable’s
inlineContent
arg.