Thierry
02/04/2020, 11:24 PMMatthewdhowell
02/04/2020, 11:26 PMZach Klippenstein (he/him) [MOD]
02/04/2020, 11:26 PM+
in front of state
Zach Klippenstein (he/him) [MOD]
02/04/2020, 11:27 PM@Model
you’ll want to use remember
jim
02/04/2020, 11:28 PM+
.Thierry
02/04/2020, 11:28 PMThierry
02/04/2020, 11:29 PMThierry
02/04/2020, 11:29 PMZach Klippenstein (he/him) [MOD]
02/04/2020, 11:29 PMval myModel = remember { MyModel() }
Although ideally pulling your state up is better like @jim is suggesting.Chuck Jazdzewski [G]
02/04/2020, 11:30 PMstate
returns an @Model
object which contains one field so it is not either one or the other but just different shades of @Model
.Matthewdhowell
02/04/2020, 11:31 PMMatthewdhowell
02/04/2020, 11:31 PMZach Klippenstein (he/him) [MOD]
02/04/2020, 11:32 PMZach Klippenstein (he/him) [MOD]
02/04/2020, 11:32 PMZach Klippenstein (he/him) [MOD]
02/04/2020, 11:32 PMso for more complex objects like a chat message with multiple fieldsIdeally make it a data class (and I think annotate with
@Immutable
?), and pass instances of the data class around.Matthewdhowell
02/04/2020, 11:33 PMMatthewdhowell
02/04/2020, 11:33 PMMatthewdhowell
02/04/2020, 11:33 PMZach Klippenstein (he/him) [MOD]
02/04/2020, 11:34 PMso all my composables need to pass their params on?Not necessarily. Another technique is to make generic composables that take composable functions as parameters, effectively acting as a “black box” to pass data down.
Zach Klippenstein (he/him) [MOD]
02/04/2020, 11:35 PMChuck Jazdzewski [G]
02/04/2020, 11:36 PMThierry
02/04/2020, 11:36 PMMatthewdhowell
02/04/2020, 11:37 PMChuck Jazdzewski [G]
02/04/2020, 11:40 PM@Model
container object of the models and use the fields to access them. This way the type checker can validate that dependency is supplied. You can then use interfaces to abstract the dependencies between modules where the root model implements the model interfaces for the dependent modules/components.Chuck Jazdzewski [G]
02/04/2020, 11:41 PMThierry
02/04/2020, 11:44 PMThierry
02/04/2020, 11:45 PMMatthewdhowell
02/04/2020, 11:46 PMThierry
02/04/2020, 11:46 PMThierry
02/04/2020, 11:50 PMMatthewdhowell
02/04/2020, 11:50 PMMatthewdhowell
02/04/2020, 11:51 PMThierry
02/04/2020, 11:51 PMThierry
02/04/2020, 11:51 PMMatthewdhowell
02/04/2020, 11:52 PMThierry
02/04/2020, 11:52 PMThierry
02/04/2020, 11:52 PMMatthewdhowell
02/04/2020, 11:53 PMThierry
02/04/2020, 11:55 PMMatthewdhowell
02/04/2020, 11:55 PMThierry
02/04/2020, 11:56 PMThierry
02/04/2020, 11:56 PMThierry
02/04/2020, 11:57 PMMatthewdhowell
02/04/2020, 11:57 PMMatthewdhowell
02/04/2020, 11:59 PMMatthewdhowell
02/05/2020, 12:00 AMMatthewdhowell
02/05/2020, 12:01 AMMatthewdhowell
02/05/2020, 12:01 AMMatthewdhowell
02/05/2020, 12:05 AMMatthewdhowell
02/05/2020, 12:13 AMChuck Jazdzewski [G]
02/05/2020, 12:16 AMMatthewdhowell
02/05/2020, 12:17 AMThierry
02/05/2020, 4:18 AM