https://github.com/sequencemedia/react-redux-render
Render isomorphic React + Redux apps and components in Node
https://github.com/sequencemedia/react-redux-render
isomorphic react redux render
Last synced: about 1 year ago
JSON representation
Render isomorphic React + Redux apps and components in Node
- Host: GitHub
- URL: https://github.com/sequencemedia/react-redux-render
- Owner: sequencemedia
- Created: 2019-05-28T18:51:40.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-05-06T21:29:34.000Z (about 1 year ago)
- Last Synced: 2025-05-07T03:43:10.471Z (about 1 year ago)
- Topics: isomorphic, react, redux, render
- Language: JavaScript
- Homepage:
- Size: 3.76 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-redux-render
Render isomorphic _React_ apps and components in Node.
- With _Redux_
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 {
configureStore
} = require('./path/to/store')
const store = configureStore()
const {
renderToString
} = require('react-redux-render')
const App = require('./path/to/react/app')
app.get('/', (req, res) => res.send(renderToString(store, 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 third argument:
```javascript
renderToString(store, App, {})
```
(Since this is a _Redux_ app you are unlikely to use `props`.)
## In this package
`react-redux-render` exports three functions:
1. `renderToString`
2. `renderToStaticMarkup`
3. `render`
`renderToString` generates `