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, applyMiddleware(actionMiddleware));
Component
import React, { Component } from 'react'
import { useActionSubscribe } from 'react-redux-action-subscribe'
function Example {
useActionSubscribe({
addItem: (payload) => {
}
});
return <MyComponent />
}
License
MIT © pyjun01