Sam
05/26/2021, 8:26 AMwindow.location.pathname
? I'd like to use single html template and make renderComposable()
inject different DOM tree based on the current pathname
. Web compose works on root host by default, and browser returns Cannot GET /path-name/
when I try to reach host/path-name/
. Is there currently any way to define supported paths so I can render different UI for them, provide 404 templates, etc?Big Chungus
05/26/2021, 8:32 AMhfhbd
05/26/2021, 8:38 AM@Composable
fun path(): String {
var path by remember { mutableStateOf("") }
SideEffect {
path = window.location.hash.removePrefix("#")
println("hash location" + window.location.hash)
println("history state" + window.history.state)
}
return path
}
https://github.com/hfhbd/ComposeTodo/tree/main/web/src/jsMain/kotlin/app/softwork/composetodo/routing