Daniele B
01/12/2021, 9:19 PMjim
01/12/2021, 9:22 PMDaniele B
01/12/2021, 9:29 PMdata class AppState (
val homeScreen = HomeScreen(),
val loginScreen = LoginScreen(),
val settingsScreen = SettingsScreen(),
val profileScreen = ProfileScreen(),
val resultsScreen = ResultsScreen(),
)
Each of these are also data classes, which hold the relevant state fields for that screen. So, it’s still modular.
My concern is about performance.Colton Idle
01/12/2021, 9:31 PMCasey Brooks
01/12/2021, 9:32 PMState<T>
level, so if you pass HomeScreen
or LoginScreen
as parameters to the each screen instead of AppState
, I think it shouldn’t impact performance too much. In general, passing the minimal amount of state necessary to each function is best for modularity and reusability as wellDaniele B
01/12/2021, 9:39 PMjim
01/13/2021, 9:32 AMhomeScreen
. The homeScreen
data should be split off and passed to the home widget, rather than passing the whole AppState object.