0.0.4 • Published 3 years ago

react-redux-action-subscribe v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-redux-action-subscribe

Add an action listener with react hooks

Install

npm install --save react-redux-action-subscribe

Usage

Redux Store

import { createStore, applyMiddleware } from 'redux';
import actionMiddleware from 'react-redux-action-subscribe';

import reducers from './reducers';

const store = createStore(reducers, initialState, applyMiddleware(actionMiddleware));

Component

import React, { Component } from 'react'
import { useActionSubscribe } from 'react-redux-action-subscribe'

function Example {

  // case 1
  useActionSubscribe({
    addItem: (action) => {

    }
  });

  // case 2
  useActionSubscribe('removeItem', (action) => {

  });

  return <MyComponent />
}

License

MIT © pyjun01

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago