https://kotlinlang.org logo
#compose-web
Title
# compose-web
a

andylamax

11/07/2021, 9:53 AM
how does one handle navigation (specifically routing) in compose-web?
b

Brian G

11/07/2021, 10:52 AM
Roll your own, or you could try https://github.com/arkivanov/Decompose
h

hfhbd

11/07/2021, 11:21 AM
👍 2
👍🏻 1
s

spierce7

11/07/2021, 4:29 PM
I highly recommend decompose. I started using it, and it’s a bit different, but once you understand how it works, I prefer it’s explicit no-magic style to something like
👀 2
b

Big Chungus

11/27/2021, 11:34 AM
For web, decompose is not a good fit, because it does not manage your url, so you lose any link functionality. I'd recommend using routing-compose, which basically mimics react routers for compose.
a

Arkadii Ivanov

11/27/2021, 11:37 AM
@Big Chungus I doesn't indeed, but it should be possible to manage urls manually. This should be a one-time job. And Decompose supports deep links as well.
b

Big Chungus

11/27/2021, 11:41 AM
If decompose is pluggable in this regard, it would be great to have js-only module to allow registering this behaviour on jsMain, but still having all your decompose code in commonMain
a

Arkadii Ivanov

11/27/2021, 11:46 AM
Yeah, I will consider this. Am I right that on navigation the page is reloaded with another URL? Or should the URL in the browser just change, following the navigation?
b

Big Chungus

11/27/2021, 11:47 AM
It should go both ways. If i change the path in url, router should react and likewise it should provide some @Composable to act as a link element, that when clicked notifies the router to change url
Have a look at how it's done in router-compose for ideas ;)
a

Arkadii Ivanov

11/27/2021, 11:52 AM
Alright, I will check. Thanks.
7 Views