Would someone have a moment to explain what the `D...
# decompose
j
Would someone have a moment to explain what the
Default*
creator functions are for? In the
RootComponent
we do
Copy code
private fun child(config: Config, componentContext: ComponentContext): RootComponent.Child =
        when (config) {
            is Config.login -> RootComponent.Child.LoginChild(loginComponent(componentContext))
        }
fun loginComponent
just does
Copy code
fun loginComponent(componentContext: ComponentContext): LoginComponent =
    DefaultLoginComponent(
        componentContext = componentContext,
        onLogin = { username, password ->
            println("LoginComponent.onSubmit: username=$username, password=$password")
        }
    )
Is there a specific reason that the quickstart doesn’t just use
DefaultLoginComponent
directly?
1
Nvm, I got it — If you keep
loginComponent
creator in the
rootComponent
it has access to stuff like
navigator
. I suppose you could pass it to
Default*
but then
Default*
is strictly related to the navigator so you can’t pass a different instance for when testing etc
TL:DR; it’s a factory
a
It's just separation of concerns, nothing special.
j
Yep 😄, just gotta jog the ole memory