https://kotlinlang.org logo
#getting-started
Title
# getting-started
m

moltendorf

06/18/2022, 9:41 PM
Hi there, looking to update an old react (kotlin) app I started on and I'm stuck on
useLocation() may be used only in the context of a <Router> component
no matter which block I put it in?
Copy code
val App = FC<Props> {
  BrowserRouter {
    Routes {
      Route {
        useLocation() // ...
k

Kirill Grouchnikov

06/18/2022, 11:37 PM
#react
m

moltendorf

06/19/2022, 12:43 AM
Actually figured this out on my own. Some reason I put it in a VFC/FC at the root level (within a BrowserRouter) and it must've not compiled right or something because I immediately moved on but going back to that and... it works! Now I'm just trying to find the best way to do things still as it seems the documentation is more currently for React + Kotlin developers looking to Kotlin their React not so much Kotlin users looking to learn React within Kotlin.
If you will, someone who reads this may have a better idea: anything I should use instead of React since I'm dead-set on being in Kotlin-first? My project is quite small.
l

Landry Norris

06/19/2022, 11:09 PM
#compose-web