Chrys
12/01/2023, 3:34 PMval appRouter = createBrowserRouter(
arrayOf(
jso {
path = "/"
element = Home.create()
},
jso {
path = "login"
element = Login.create()
},
jso {
path = "dashboard"
element = Dashboard.create()
}
)
)
Any hint here?Artem Kobzar
12/01/2023, 5:18 PMlogin
and dashboard
into the children
section of the /
path like this:
https://reactrouter.com/en/main/routers/create-browser-router
val appRouter = createBrowserRouter(
arrayOf(
jso {
path = "/"
element = Home.create(),
children = arrayOf(
jso {
path = "login"
element = Login.create()
},
jso {
path = "dashboard"
element = Dashboard.create()
}
)
},
)
)
Chrys
12/02/2023, 11:18 AMArtem Kobzar
12/03/2023, 7:39 AMturansky
12/03/2023, 10:41 AMindex.html
usually).
For other pages you need redirect from server.
If you don't want to use server - you can use createHashRouter (example).turansky
12/03/2023, 10:44 AMComponent
property
val appRouter = createBrowserRouter(
arrayOf(
jso {
path = "/"
Component = Home,
children = arrayOf(
jso {
path = "login"
Component = Login
},
jso {
path = "dashboard"
Component = Dashboard
}
)
},
)
)
Chrys
12/03/2023, 6:57 PMturansky
12/03/2023, 7:10 PMlogin
and dashboard
pages.
For other pages you can register page 404
in router.Chrys
12/04/2023, 11:17 AM