You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A minimal example using dynamic segments, i.e. using `Route(to = ":id/*")`.
328
326
329
-
If you want to observe the `url_hash` of the shiny session, you need to use a workaround ([issue #4](https://github.com/lgnbhl/reactRouter/issues/4)) to get the correct `url_hash` path by reloading the session when the user click on a link, as showed below:
330
-
331
327
```r
332
328
library(shiny)
333
329
library(reactRouter)
334
330
library(bslib)
335
331
336
332
ui<- HashRouter(
337
333
bslib::page(
338
-
reactRouter::Link.shinyInput(
339
-
inputId="home",
334
+
Link(
340
335
to="/",
341
336
h3("reactRouter with dynamic routes", class="m-3"),
342
337
style="text-decoration: none; color: black"
@@ -346,28 +341,26 @@ ui <- HashRouter(
346
341
path="/",
347
342
element= div(
348
343
# tags$a() necessary to observe `url_hash` in session
349
-
tags$a(
350
-
href="#/project/1/overview",
344
+
NavLink(
345
+
to="project/1/overview",
351
346
"Project 1"
352
347
),
353
348
tags$br(),
354
-
tags$a(
355
-
href="#/project/2/overview",# go directly to overview
349
+
NavLink(
350
+
to="project/2/overview",
356
351
"Project 2"
357
352
)
358
353
)
359
354
),
360
355
Route(
361
356
path="project/:id/*",
362
357
element= div(
363
-
NavLink.shinyInput(
364
-
inputId="overview",
358
+
NavLink(
365
359
to="overview",
366
360
"Overview"
367
361
),
368
362
tags$br(),
369
-
NavLink.shinyInput(
370
-
inputId="analysis",
363
+
NavLink(
371
364
to="analysis",
372
365
"Analysis"
373
366
),
@@ -390,11 +383,6 @@ ui <- HashRouter(
390
383
391
384
server<-function(input, output, session) {
392
385
393
-
# Necessary to update `url_hash` to get "" (homepage), "1/analysis" and "2/analysis"
0 commit comments