# react-response-router

> React server-side rendering implementation with minimal configuration.

Latest version **0.1.0** (published 2016-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-response-router
pnpm add react-response-router
yarn add react-response-router
bun add react-response-router
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-02-14 |
| First published | 2016-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel Dunderfelt |
| Maintainers | danieldunderfelt |
| Keywords | react, server-side rendering, react-response react-router, react-response |

## Links

- npm: https://www.npmjs.com/package/react-response-router
- Repository: https://github.com/danieldunderfelt/react-response-router
- Homepage: https://github.com/danieldunderfelt/react-response
- Issues: https://github.com/danieldunderfelt/react-response/issues
- npm.io page: https://npm.io/package/react-response-router

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-02-14
- 0.0.3 (alpha2) — 2016-02-14
- 0.0.2 (alpha) — 2016-02-14

## README

React-response
===

React-router response handler
---

This package provides a React-router-integrated response handler for [React-response](https://github.com/danieldunderfelt/react-response). It is built to integrate with React-response, but there's actually nothing here that stops it from being used in vanilla servers. The only (peer)dependency is React-router.

This readme assumes that you are somewhat familiar with React-response.

### How to use it

When you have a React-response server build set up, simply import `createReactRouterResponse` from this package and call it with your React-router route config. Then give the returned function to the `<Response />` component of React-response as the `handler` prop. Like this:

```javascript
// In your React-response server setup:
<Response template={ Html } handler={ createReactRouterResponse(routes) }>
    {(renderProps, req, res) => {
        return { component: ReactDOM.renderToString(
            <RouterContext { ...renderProps } />
        ) }
    }}
</Response>

```

Make sure to render `<RouterContext />` from React-router with the `renderProps`. Consult [the documentation](https://github.com/reactjs/react-router/blob/latest/docs/guides/ServerRendering.md) of React-router for more information.

The above can also be accomplished like this:

```javascript

<Response template={ Html } handler={ createReactRouterResponse(routes) }>
    <RouterContext />
</Response>

```

Note that `<RouterContext />` will dislike being called without its renderProps. This is a one-time warning when you start the server and will not impede the functionality of your app.

# Test and build

This project uses Tape and Sinon for testing and Gulp as its build system. Run the test suite with `gulp test`. Build the package with `gulp build`

# Collaboration

PR's welcome! Please add tests for all changes and follow the general coding style. Semicolons are banned ;)

Please send all issues to [React-response's issue tracker](https://github.com/danieldunderfelt/react-response/issues).

---
_Source: https://npm.io/package/react-response-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
