Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jisaacks/redux-action-director
https://github.com/jisaacks/redux-action-director
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jisaacks/redux-action-director
- Owner: jisaacks
- Created: 2016-02-11T06:39:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-02-11T06:56:01.000Z (over 8 years ago)
- Last Synced: 2024-09-22T01:10:56.613Z (about 1 month ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redux Action Director
A simple library to map routes to redux action creators.
### Why?
First, I think [react-router](https://github.com/rackt/react-router) is awesome. However, when using the combination of react-router with redux and needing to fetch data based on route params and store that data in redux it can get a little hairy. This is a scenario they are still trying to figure out the best way to handle. Until then, this is a simple solution. It does not offer all the power of react-router and is not intended to. It simply provides an easy way to have routes trigger action creators.
It is actually a tiny wrapper around [director](https://github.com/flatiron/director) that allows you to specify the action creators and it will dispatch them instead of just invoking them.
### Usage
```javascript
import { createRouter } from 'redux-action-director';
import { fetchPost } from './actions';
import store from './store';export default createRouter(store, {
"/posts/:id": fetchPost
});
```