react-router-dispatcher-status-code
A react-router-dispatcher action for defining react-router status codes that support server-side streaming.
Read the react-router-dispatcher documentation if you haven't already done so.
Install
NPM
npm install --save react-router-dispatcher-status-code
Yarn
yarn add react-router-dispatcher-status-code
Usage
; // STATUS_CODE is the action name, used to configure react-router-dispatcher
Example
withStatusCode()
Defining routes using // routes.js;; const routes = component: Root routes: path: '/' exact: true component: Home // Configure a 404 - not found route for rendering invalid routes component: NoMatch ;
react-router-dispatcher
Configuring the metadata action using;;; const UniversalRouteDispatcher ClientRouteDispatcher dispatchClientActions dispatchServerActions } = ; // Server dispatch;
API
statusCodeAction(statusCode)
Parameters
statusCode: number
- The statusCode to assign to the response
withStatusCode(statusCode)
Parameters
statusCode: number
- The statusCode to assign to the response
Contribute
For questions or issues, please open an issue, and you're welcome to submit a PR for bug fixes and feature requests.
Before submitting a PR, ensure you run npm test
to verify that your coe adheres to the configured lint rules and passes all tests. Be sure to include unit tests for any code changes or additions.
License
MIT