Skip to content

Commit bc70bd0

Browse files
pkgdown build_site
1 parent 4a9d11e commit bc70bd0

File tree

17 files changed

+1372
-44
lines changed

17 files changed

+1372
-44
lines changed

docs/LICENSE.html

Lines changed: 20 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/index.html

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/intro_reactR.html

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/intro_reactR.utf8.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: "Intro to reactR"
3+
author: "Kent Russell"
4+
date: "2018-02-20"
5+
output: rmarkdown::html_vignette
6+
vignette: >
7+
%\VignetteIndexEntry{Intro to reactR}
8+
%\VignetteEngine{knitr::rmarkdown}
9+
%\VignetteEncoding{UTF-8}
10+
---
11+
12+
## Why reactR?
13+
14+
[`react`](https://facebook.github.io/react/) has become incredibly popular, and the ecosystem around `react` is robust. `reactR` aims to allow `R` users to more easily incorporate `react` and `JSX`.
15+
16+
## Install
17+
18+
```
19+
install.packages("reactR")
20+
21+
# for the latest development version
22+
# install from Github
23+
# devtools::install_github("timelyportfolio/reactR")
24+
```
25+
26+
## Quick Example
27+
28+
Let's use `react` to render a simple `h1` HTML element below.
29+
30+
<div id="react-heading-here"></div>
31+
32+
33+
```r
34+
library(reactR)
35+
library(htmltools)
36+
37+
attachDependencies(
38+
tags$script(
39+
"
40+
ReactDOM.render(
41+
React.createElement(
42+
'h1',
43+
null,
44+
'Powered by React'
45+
),
46+
document.getElementById('react-heading-here')
47+
)
48+
"
49+
),
50+
html_dependency_react()
51+
)
52+
```
53+
54+
preserve152bd2f5d7127d49
55+
56+
## Blog Post
57+
58+
For more on how we can use R and React, see the blog post [React in R](http://www.jsinr.me/2017/11/19/react-in-r/). Also, there are many more examples in the Github repo at [inst/examples](https://github.com/timelyportfolio/reactR/tree/master/inst/examples).
59+
60+
## Using JSX
61+
62+
[`JSX`](https://facebook.github.io/react/docs/jsx-in-depth.html) helps ease some of the burden caused by `React.createElement`. `reactR` provides a `babel_transform()` function to use `JSX`. Hopefully, in the future, we can convince RStudio to modify `htmltools` to work directly with `JSX` (see [issue](https://github.com/rstudio/htmltools/pull/72)).

0 commit comments

Comments
 (0)