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
`reactR` provides a set of convenience functions for using [`React`](https://facebook.github.io/react) in `R` with `htmlwidget` constructor templates and local JavaScript dependencies. The `React` ecosystem is rich with components that can enhance `R` web and Shiny apps. `scaffoldReactWidget()` helps build `htmlwidgets` to integrate these `React` components as `R``htmlwidgets`. The local dependency functions are modeled after the `html_dependency_*` functions from RStudio's [`rmarkdown`](https://github.com/rstudio/rmarkdown) package.
25
+
26
+
## Installation
27
+
28
+
You can install reactR from CRAN with `install.packages("reactR")`. For the development version, please use `devtools` as shown below.
29
+
30
+
```R
31
+
# install.packages("devtools")
32
+
devtools::install_github("react-R/reactR")
33
+
```
34
+
35
+
## Creating htmlwidgets with React Components
36
+
37
+
To wrap a `React` component as an `htmlwidget`, please see the tutorial [htmlwidgets with reactR](https://react-r.github.io/reactR/articles/intro_htmlwidgets.html). Also, there are a variety of examples in the [react-R Github organization](https://github.com/react-R).
38
+
39
+
## Examples
40
+
41
+
```R
42
+
library(reactR)
43
+
library(htmltools)
44
+
45
+
browsable(tagList(
46
+
tags$div(id="app"),
47
+
tags$script(
48
+
"
49
+
ReactDOM.render(
50
+
React.createElement(
51
+
'h1',
52
+
null,
53
+
'Powered by React'
54
+
),
55
+
document.getElementById('app')
56
+
)
57
+
"
58
+
),
59
+
#add core-js first to work in RStudio Viewer
60
+
html_dependency_corejs(),
61
+
html_dependency_react()
62
+
))
63
+
```
64
+
65
+
`reactR` also uses the `V8` package if available to transform `JSX` and `ES2015` code.
66
+
67
+
```R
68
+
library(reactR)
69
+
library(htmltools)
70
+
71
+
browsable(
72
+
tagList(
73
+
tags$div(id="app"),
74
+
tags$script(
75
+
babel_transform('ReactDOM.render(<h1>Powered By React/JSX</h1>,document.getElementById("app"))')
76
+
),
77
+
# add core-js shim first for React in RStudio Viewer
78
+
html_dependency_corejs(),
79
+
html_dependency_react()
80
+
)
81
+
)
82
+
```
83
+
84
+
## Contributing and Code of Conduct
85
+
86
+
We welcome contributors and would love your participation. Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by the terms.
`reactR` provides a set of convenience functions for using [`React`](https://facebook.github.io/react) in `R` with `htmlwidget` constructor templates and local JavaScript dependencies. The `React` ecosystem is rich with components that can enhance `R` web and Shiny apps. `scaffoldReactWidget()` helps build `htmlwidgets` to integrate these `React` components as `R``htmlwidgets`. The local dependency functions are modeled after the `html_dependency_*` functions from RStudio's [`rmarkdown`](https://github.com/rstudio/rmarkdown) package.
12
+
`reactR` provides a set of convenience functions for using
13
+
[`React`](https://facebook.github.io/react) in `R` with `htmlwidget`
14
+
constructor templates and local JavaScript dependencies. The `React`
15
+
ecosystem is rich with components that can enhance `R` web and Shiny
16
+
apps. `scaffoldReactWidget()` helps build `htmlwidgets` to integrate
17
+
these `React` components as `R``htmlwidgets`. The local dependency
18
+
functions are modeled after the `html_dependency_*` functions from
You can install reactR from CRAN with `install.packages("reactR")`. For the development version, please use `devtools` as shown below.
23
+
You can install reactR from CRAN with `install.packages("reactR")`. For
24
+
the development version, please use `devtools` as shown below.
13
25
14
-
```R
26
+
```r
15
27
# install.packages("devtools")
16
28
devtools::install_github("react-R/reactR")
17
29
```
18
30
19
31
## Creating htmlwidgets with React Components
20
32
21
-
To wrap a `React` component as an `htmlwidget`, please see the tutorial [htmlwidgets with reactR](https://react-r.github.io/reactR/articles/intro_htmlwidgets.html). Also, there are a variety of examples in the [react-R Github organization](https://github.com/react-R).
33
+
To wrap a `React` component as an `htmlwidget`, please see the tutorial
Also, there are a variety of examples in the [react-R Github
37
+
organization](https://github.com/react-R).
22
38
23
39
## Examples
24
40
25
-
```R
41
+
```r
26
42
library(reactR)
27
43
library(htmltools)
28
44
@@ -46,9 +62,10 @@ browsable(tagList(
46
62
))
47
63
```
48
64
49
-
`reactR` also uses the `V8` package if available to transform `JSX` and `ES2015` code.
65
+
`reactR` also uses the `V8` package if available to transform `JSX` and
66
+
`ES2015` code.
50
67
51
-
```R
68
+
```r
52
69
library(reactR)
53
70
library(htmltools)
54
71
@@ -67,4 +84,7 @@ browsable(
67
84
68
85
## Contributing and Code of Conduct
69
86
70
-
We welcome contributors and would love your participation. Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by the terms.
87
+
We welcome contributors and would love your participation. Please note
88
+
that this project is released with a [Contributor Code of
89
+
Conduct](CONDUCT.md). By participating in this project you agree to
0 commit comments