Could I get some feedback on my state management? ...
# compose
t
Could I get some feedback on my state management? I've made a little game where the board is generated based on the current date and the selected board size. Is this simple example handling state appropriately? (Code in https://sandstorm.appux.com/shared/Ht7Wf-apel4_RH9SIg89fCJOjatSQb-AHLRSBUIP-xl/timmc/comp1337/src/56ee7d08df37e03c54f13e78a323d5713e6538d9/src/jvmMain/kotlin/UI.kt at the bottom.) [EDIT: Fixed link.]
This is what it looks like currently, to give some context.
The size and date start out based on some defaults, and have independent remember/mutableStateOf blocks. The board state is in a third block and has remember-keys based on the first two.
Note that the third line of text includes the size and date.
When the user clicks one of the new-game buttons, all three of the state objects are set to new values. (The date should stay consistent throughout a game, but should be re-computed when a new game is started.)
s
Link doesnt work ­čĄö
t
Oops! Fixed it.
I'm thinking that the remember block for the game board doesn't actually need keys specified, since it's not recomputed automatically.