https://github.com/alt-j/fast-react-render
[DEPRECATED] Use last versions of React and Node.js for better performance
https://github.com/alt-j/fast-react-render
cache performance react react-dom render server-side-rendering
Last synced: 7 days ago
JSON representation
[DEPRECATED] Use last versions of React and Node.js for better performance
- Host: GitHub
- URL: https://github.com/alt-j/fast-react-render
- Owner: alt-j
- License: mit
- Created: 2016-08-31T13:04:56.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-23T11:08:54.000Z (over 7 years ago)
- Last Synced: 2025-05-22T22:56:11.517Z (28 days ago)
- Topics: cache, performance, react, react-dom, render, server-side-rendering
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 99
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
With the release of the new version [React](https://reactjs.org/blog/2017/09/26/react-v16.0.html#better-server-side-rendering) and Node.js the performance issue has ceased to be so acute. Use last versions of React and Node.js for better performance.
======# [React] Server render [](https://travis-ci.org/alt-j/fast-react-render) [](https://coveralls.io/github/alt-j/fast-react-render?branch=master)
The module for rendering react-element in the server **3 times as fast** (see [benchmarks](https://github.com/alt-j/react-server-benchmark)) as [traditional react rendering](https://facebook.github.io/react/docs/environments.html) (in production mode).
## Quick start
All you need to use it, is only:
1) install package
```sh
npm install fast-react-render
```2) replace you render to:
```js
var ReactRender = require('fast-react-render');var element = React.createElement(Component, {property: 'value'});
console.log(ReactRender.elementToString(element, {context: {}}));
```## Cache
React server rendering support cache for component.
First of all, you must choose cache system. It can be any system, which implement ICache interface ([interface](src/interfaces/i-cache.js)).
For caching, component must implement ICacheableComponent interface ([interface](src/interfaces/i-cacheable-component.js)).Example with using LRU cache: [render with LRU cache](examples/cache.js) (install `lru-cache` package first).
## What's next
If you need more performance, you can try use [fast-react-server](https://github.com/alt-j/fast-react-server) - is high speed mock for react, which provide rendering **11 times as fast** as traditional, but require more configuration for build system.