Skip to content

Commit 64b75c3

Browse files
committed
overview
1 parent 4647890 commit 64b75c3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# ReactCC
22

33
## Overview
4+
ReactCC is a component-level caching library for rendering React components on the server.
5+
- Use any of React's four server-side rendering methods
6+
- Cache simple components or templates
7+
- Choose from three cache implementations (LRU, Redis, or Memcached)
48

59
## Installation
610
Using npm:
@@ -10,14 +14,17 @@ $ npm install --save rapscallion
1014

1115
## Usage
1216
### In Node rendering server:
17+
Instantiate a cache and pass it into any rendering method as a second argument. Wherever you would use ReactDOM.renderToString, use ReactCC.renderToString.
1318
```javascript
1419
const ReactCC = require("reactcc");
20+
const cache = ReactCC.ComponentCache();
21+
ReactCC.renderToString(<App />, cache>)
1522

1623
// ...
1724
```
1825

1926
### In React app:
20-
To cache a component, simply add a 'cache' property to it. To create a cache template, add both 'cache' and 'templatized'.
27+
To flag a component for caching, simply add a 'cache' property to it. To create a cache template, add both 'cache' and 'templatized', along with an array of props to templatize.
2128

2229
```javascript
2330
export default class App extends Component {
@@ -75,14 +82,13 @@ Insert description and implementation here
7582

7683
## API
7784

78-
### `ReactCC`
85+
### ReactCC
7986
ReactCC gives you access to all four of React 16's server-side rendering methods, as well as additional functionality. ReactCC methods are described below.
8087

81-
### `ComponentCache`
88+
### ComponentCache
8289
- `size`: (Optional) An integer representing the maximum size (in characters) of the cache. Defaults to 1 million.
8390

8491
**Example:**
85-
8692
```javascript
8793
const cache = new ReactCC.ComponentCache();
8894
```
@@ -93,7 +99,6 @@ const cache = new ReactCC.ComponentCache();
9399
- `memLife`: (Only if using Memcached) A number representing the lifetime (in seconds) of each Memcached entry. Defaults to 0.
94100

95101
**Example:**
96-
97102
```javascript
98103
ReactCC.renderToString(<App />, cache);
99104
```
@@ -104,7 +109,6 @@ ReactCC.renderToString(<App />, cache);
104109
- `memLife`: (Only if using Memcached) An integer representing the lifetime (in seconds) of each Memcached entry. Defaults to 0.
105110

106111
**Example:**
107-
108112
```javascript
109113
ReactCC.renderToStaticMarkup(<App />, cache);
110114
```
@@ -115,7 +119,6 @@ ReactCC.renderToStaticMarkup(<App />, cache);
115119
- `memLife`: (Only if using Memcached) An integer representing the lifetime (in seconds) of each Memcached entry. Defaults to 0.
116120

117121
**Example:**
118-
119122
```javascript
120123
ReactCC.renderToNodeStream(<App />, cache);
121124
```
@@ -126,9 +129,6 @@ ReactCC.renderToNodeStream(<App />, cache);
126129
- `memLife`: (Only if using Memcached) An integer representing the lifetime (in seconds) of each Memcached entry. Defaults to 0.
127130

128131
**Example:**
129-
130132
```javascript
131133
ReactCC.renderToStaticNodeStream(<App />, cache);
132134
```
133-
134-
-----

0 commit comments

Comments
 (0)