One of Compose Desktop examples uses the following snippet as entry point:
fun main() = application {
CompositionLocalProvider(LocalAppResources provides rememberAppResources()) {
NotepadApplication(rememberApplicationState())
}
}
Here's the definition of rememberApplicationState():
@Composable
fun rememberApplicationState() = remember {
NotepadApplicationState().apply {
newWindow()
}
}
I don't really understand why to remember a top-level app's state here. As far as I understand, recomposition is not expected neither for application nor for CompositionLocalProvider. Can we just pass an instance of NotepadApplicationState without any consequences?