"*Key Point:* When hoisting state, there are three rules to help you figure out where state should go:
1. State should be hoisted to at
least the
lowest common parent of all composables that use the state (read).
2. State should be hoisted to at
least the
highest level it may be changed (write).
3. If
two states change in response to the same events they should be
hoisted together.
You can hoist state higher than these rules require, but underhoisting state will make it difficult or impossible to follow unidirectional data flow" official docs have mentioned about this in
https://developer.android.com/jetpack/compose/state#state-hoisting