| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Declarative data fetching for Redux and React.
npm install --save-dev @unfold/fetch-data
yarn add --dev @unfold/fetch-data
import { createFetchMiddleware } from '@unfold/fetch-data'
const store = createStore(reducers, initialState, applyMiddleware(thunk, createFetchMiddleware()))import { createRequestsReducer, createEntityReducer } from '@unfold/fetch-data'
import { combineReducers } from 'redux'
const reducers = combineReducers({
requests: createRequestsReducer(),
posts: createEntityReducer('LIST_POSTS')
})import fetchData, { createFetchAction } from '@unfold/fetch-data'
const listPosts = () => createFetchAction({
url: 'http://api.io/posts'
})
const ProfileContainer = fetchData({
mapPropsToAction: () => listPosts()
}, {
mapStateToProps: ({ posts }) => posts
})| Back | FazBrowse Home | New Git URL |