https://github.com/sequencemedia/react-render
Render isomorphic React apps and components in Node
https://github.com/sequencemedia/react-render
isomorphic react render
Last synced: 5 months ago
JSON representation
Render isomorphic React apps and components in Node
- Host: GitHub
- URL: https://github.com/sequencemedia/react-render
- Owner: sequencemedia
- Created: 2019-05-28T20:58:51.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-06-28T05:34:18.000Z (12 months ago)
- Last Synced: 2025-06-28T05:46:28.292Z (12 months ago)
- Topics: isomorphic, react, render
- Language: JavaScript
- Homepage:
- Size: 4.08 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-render
Render isomorphic _React_ apps and components in Node.
An example implementation of the companion package `@sequencemedia/react-router-redux-render` can be found in [react-router-pagination-io](http://github.com/sequencemedia/react-router-pagination-io.git).
## Example
In Express:
```javascript
const express = require('express')
const app = express()
const port = 3000
const {
renderToString
} = require('react-render')
const App = require('./path/to/react/app')
app.get('/', (req, res) => res.send(renderToString(App)))
app.listen(port, () => console.log(`Express ${port}`))
```
If `renderToString` encounters an error then it throws a `500 Internal Server Error`. Otherwise, it returns a string.
You can supply `App` with `props` using the second argument:
```javascript
renderToString(App, {})
```
(Since this is not a _Redux_ app you are likely to use `props`.)
## In this package
`react-render` exports three functions:
1. `renderToString`
2. `renderToStaticMarkup`
3. `render`
`renderToString` generates `