Skip to content

Commit 8174f4d

Browse files
add some discussion on new htmlwidget functionality in README
1 parent 582bb4a commit 8174f4d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/reactR)](https://cran.r-project.org/package=reactR)
22
[![Travis-CI Build Status](https://travis-ci.org/react-R/reactR.svg?branch=master)](https://travis-ci.org/react-R/reactR)
33

4-
<img height="150px" alt="react-R logo" src="assets/logos/reactR-logo.png"/>
4+
<img height="150px" alt="react-R logo" src="https://github.com/react-R/reactR/raw/enhancements/assets/logos/reactR-logo.png"/>
55

66
# reactR
77

8-
A set of convenience function with local dependencies for using [`React`](https://facebook.github.io/react) in `R`. This is modeled after the `html_dependency_*` functions from RStudio's [`rmarkdown`](https://github.com/rstudio/rmarkdown) package.
8+
`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 comoponents that can enhance `R` web and shiny apps. `scaffoldWidget` 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.
99

1010
## Installation
1111

12-
You can install reactR from github with:
12+
You can install reactR from CRAN with `install.packages("reactR")`. For the development version, please use `devtools` as shown below.
1313

1414
```R
1515
# install.packages("devtools")
1616
devtools::install_github("react-R/reactR")
1717
```
1818

19-
## Example
19+
## Creating htmlwidgets with React Components
20+
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).
22+
23+
## Examples
2024

2125
```R
2226
library(reactR)
2327
library(htmltools)
2428

2529
browsable(tagList(
30+
tags$div(id = "app"),
2631
tags$script(
2732
"
2833
ReactDOM.render(
@@ -31,7 +36,7 @@ browsable(tagList(
3136
null,
3237
'Powered by React'
3338
),
34-
document.body
39+
document.getElementById('app')
3540
)
3641
"
3742
),
@@ -41,16 +46,17 @@ browsable(tagList(
4146
))
4247
```
4348

44-
`reactR` also uses `V8` if available to transform `JSX` and `ES2015` code.
49+
`reactR` also uses the `V8` package if available to transform `JSX` and `ES2015` code.
4550

4651
```R
4752
library(reactR)
4853
library(htmltools)
4954

5055
browsable(
5156
tagList(
57+
tags$div(id = "app"),
5258
tags$script(
53-
babel_transform('ReactDOM.render(<h1>Powered By React/JSX</h1>,document.body)')
59+
babel_transform('ReactDOM.render(<h1>Powered By React/JSX</h1>,document.getElementById("app"))')
5460
),
5561
# add core-js shim first for React in RStudio Viewer
5662
html_dependency_corejs(),
@@ -61,4 +67,4 @@ browsable(
6167

6268
## Contributing and Code of Conduct
6369

64-
I welcome contributors. Help make this package great. 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 its terms.
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.

0 commit comments

Comments
 (0)