0.9.1 • Published 4 years ago

@redux-tools/middleware-react v0.9.1

Weekly downloads
199
License
MIT
Repository
github
Last release
4 years ago

@redux-tools/middleware-react

React bindings for the @redux-tools/middleware package.

API Reference

withMiddleware

Creates a component decorator which handles the lifecycle of passed middleware, mounting and unmounting them automatically. The namespace of the middleware is determined based on React context.

Arguments

  1. middleware (Object): The middleware to use.
  2. options (Object): Options for the decorator. Possible options: isGlobal: boolean, isPersistent: boolean, feature: string, and namespace: string.

Returns

(Function): A component decorator.

Example

import React from 'react';
import { withMiddleware } from '@redux-tools/middleware-react';

import { someMiddleware } from './middleware';

const Container = () => null;

export default withMiddleware({ someMiddleware })(Container);

<Provider />

See injectors-react for more info.