-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.Rmd
More file actions
65 lines (49 loc) · 2.28 KB
/
README.Rmd
File metadata and controls
65 lines (49 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r message=FALSE, warning=FALSE, include=FALSE}
# get JS dependencies
dependencies <- jsonlite::fromJSON("js/package.json")$dependencies
```
# reactRouter <img src="man/figures/logo.png" align="right" height="138" />
<!-- badges: start -->
[](https://CRAN.R-project.org/package=reactRouter)
[](https://cran.r-project.org/package=reactRouter)
[](https://github.com/lgnbhl/reactRouter/actions/workflows/R-CMD-check.yaml)
`r badger::badge_custom(names(dependencies)[1], dependencies[1], "blue", "https://reactrouter.com")`
[](https://www.linkedin.com/in/FelixLuginbuhl)
<!-- badges: end -->
The goal of **reactRouter** is to provide an R wrapper around [React Router](https://reactrouter.com), which enables client-side routing, nested routes, dynamic segments, data loaders, actions, and navigation hooks.
### Usage
You can easily add URL pages in a Quarto document or R Shiny app like so:
```r
library(reactRouter)
library(htmltools)
RouterProvider(
router = createHashRouter(
Route(
path = "/",
element = div(
NavLink(to = "/", "Main"), " | ",
NavLink(to = "/analysis", "Analysis"), hr(),
Outlet()
),
Route(index = TRUE, element = "Main content"),
Route(path = "analysis", element = "Analysis content")
)
)
)
```
### Install
```r
#remotes::install_github("lgnbhl/reactRouter") # development version
install.packages("reactRouter")
```
### Resources
- [Package documentation](https://felixluginbuhl.com/reactRouter/)
- [Getting Started vignette](https://felixluginbuhl.com/reactRouter/articles/introduction.html)
- [All R examples](https://github.com/lgnbhl/reactRouter/tree/main/inst/examples)
- [Official Material UI docs](https://mui.com/material-ui/getting-started/)
### Contribute
Would you like to contribute to the package? Have a look at the current [roadmap](https://github.com/users/lgnbhl/projects/2/views/1).