https://github.com/ziolko/auto-dispatch
  
  
    The declarative way to fetch data required by your React & Redux app 
    https://github.com/ziolko/auto-dispatch
  
        Last synced: 20 days ago 
        JSON representation
    
The declarative way to fetch data required by your React & Redux app
- Host: GitHub
- URL: https://github.com/ziolko/auto-dispatch
- Owner: ziolko
- License: mit
- Created: 2018-02-25T17:13:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-25T17:34:00.000Z (over 7 years ago)
- Last Synced: 2025-10-12T02:13:17.166Z (20 days ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
- License: LICENSE
 
Awesome Lists containing this project
README
          This library exports a React component that automatically dispatches a Redux action
when rendered. You can use it to trigger data fetch instead of doing it imperatively 
in `componentDidMount`. 
# Example
```js
import { connect } from 'react-redux'
import AutoDispatch from 'auto-dispatch'
// Action creator
const fetchCardDetails = cardId => ({ 
  type: 'FETCH_CARD_DETAILS', 
  cardId 
})
// React component that automatically fetches required data
const Card = props => (
  
    
    {
      /* Card display logic */
    }
  
)
```
# How it works
The action given as an argument is dispatched on initial render and every time 
it changes (deep comparison is performed). In the example above action `FETCH_CARD_DETAILS`
is dispatched every time `props.cardId` changes.
# License
https://opensource.org/licenses/MIT