Skip to contents

The goal of reactRouter is to provide a wrapper around React Router.

[!CAUTION] Breaking Change in v.0.2.0 : reloadDocument is now FALSE by default in NavLink() and Link(). Set reloadDocument = TRUE only when target routes contain Shiny server-rendered output like uiOutput() / renderUI() in dynamic segments (/:id/).

Usage

You can easily add URL pages in a Quarto document or R Shiny app like so:

library(reactRouter)
library(htmltools)

RouterProvider(
  Route(
    path = "/",
    element = div(
      NavLink(to = "/", "Main"),
      NavLink(to = "/analysis", "Analysis"),
      Outlet()
    ),
    Route(index = TRUE, element = "Main content"),
    Route(path = "analysis", element = "Analysis content")
  )
)

Install

#remotes::install_github("lgnbhl/reactRouter") # development version

install.packages("reactRouter")

Contribute

Would you like to contribute to the package? Have a look at the current roadmap.