I'm not sure what you mean by "its not a static nu...
# compose
j
I'm not sure what you mean by "its not a static number of pages/lists", but your idea of hoisting the state up is the right pattern. If you have multiple pieces of data that need to be hoisted, you can define an class. For example, suppose you have a "ProfilePage" which has three scroll views, you can define a class like:
Copy code
class ProfilePageState {
  val scrollState1 = mutableStateOf<ScrollState>(ScrollState())
  val scrollState2 = mutableStateOf<ScrollState>(ScrollState())
  val scrollState3 = mutableStateOf<ScrollState>(ScrollState())
}
The parent can then create a ProfilePageState object without knowing anything about the implementation of the ProfilePage (all it knows is that a ProfilePage needs one of these ProfilePageState objects). We call this pattern "black box state" because the internals of the state object are a black box to the owner of the object. Does that answer your question?