tests/testthat/test-apps/UseParams/App.R

library(shiny)

ui <- reactRouter::RouterProvider(
  router = reactRouter::createHashRouter(
    reactRouter::Route(
      path = "/",
      element = div(
        reactRouter::Outlet()
      ),
      reactRouter::Route(
        path = "user/:id",
        element = div(
          div(
            id = "paramId",
            reactRouter::useParams(
              tags$span(),
              selector = "id"
            )
          ),
          div(
            id = "paramAll",
            reactRouter::useParams(
              tags$span()
            )
          )
        )
      )
    )
  )
)

server <- function(input, output, session) {}

shinyApp(ui, server)

Try the reactRouter package in your browser

Any scripts or data that you put into this service are public.

reactRouter documentation built on May 10, 2026, 5:07 p.m.