An open API service indexing awesome lists of open source software.

https://github.com/pyjun01/react-redux-action-subscribe

Add an action listener with react hooks
https://github.com/pyjun01/react-redux-action-subscribe

micro-library

Last synced: about 1 month ago
JSON representation

Add an action listener with react hooks

Awesome Lists containing this project

README

          

# react-redux-action-subscribe

Add an action listener with react hooks

## Install

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

## Usage

### Redux Store

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

import reducers from './reducers';

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

### Component

```tsx
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
}
```

## License

MIT © [pyjun01](https://github.com/pyjun01)