Want to understand how recompose work in following case. In case, uber state from view model is directly passed to all composables instead of passing state that individual composable need. Would that cause recompose on all composables? In the end, it will be calling basic composable (e.g Text) which won't trigger to regenerate UI but does it have any impact on performance issue since parent composables are revomposed? Or its just best practice to send the state what individual composable needs.
Thanks a lot for the link @julioromano! I was able to grab most of it.It means recompose will be called on all of the composables so it's better not to pass uber state, since it does take a toll to invalidate that compose based on 1st example from the thread. 2nd example passes specific state so it skips recomposition.
correct me if i'm wrong.
1 year ago
In pure theory yes, but in practice this will never translate into a performance penalty, so you shouldn’t let this kind of thoughts dictate how you write your code. This is premature optimization which in 99% of the cases is useless.Please take a look at this thread which had a question similar to yours: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1616602800058000