After watching Lackner's Decompose video and writi...
# decompose
s
After watching Lackner's Decompose video and writing frontends in multiple languages + frameworks [esp. I like Angular's routing]; and seeing xxfast/Decompose-Router; I was thinking… Can Decompose be adapted to an everything-is-an-URL zero-config routing approach? •
goto("/foo")
; •
@Decompose("/") Composable() fun App() {
; • `@Decompose("items/{id}")`` (this last one with the
/
left off to enable different mount points). (maybe you can override the history so back doesn't go to the other item you clicked on but goes back a screen; but zero config it just acts like the web browser) I understand the critique about strong typing. But you can probably solve that through an
un
sealed
enum
and it would still be super readable. Appreciate your insights. Thanks
a
I think it should be possible to create an API similar to the official navigation-compose library, and use Decompose under the hood. But in this case why not just use navigation-compose?
s
Hmm… looks like it's now supported everywhere https://mvnrepository.com/artifact/org.jetbrains.androidx.navigation Working through https://developer.android.com/codelabs/jetpack-compose-navigation#9 it's a little less effort to get setup; also it uses expected components like
ViewModel
. Maybe you're right, and I should switch from Decompose.
a
Yeah, if you prefer the url based navigation, I think that's the way to go.