How to use the redux-query.queryMiddleware function in redux-query

To help you get started, we’ve selected a few redux-query examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amplitude / redux-query / examples / async / store / configureStore.js View on Github external
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import rootReducer from '../reducers'
import { queryMiddleware } from 'redux-query'

const createStoreWithMiddleware = applyMiddleware(
  thunkMiddleware,
  queryMiddleware((state) => state.queries, (state) => state.entities),
  createLogger()
)(createStore)

export default function configureStore(initialState) {
  const store = createStoreWithMiddleware(rootReducer, initialState)

  if (module.hot) {
    // Enable Webpack hot module replacement for reducers
    module.hot.accept('../reducers', () => {
      const nextRootReducer = require('../reducers')
      store.replaceReducer(nextRootReducer)
    })
  }

  return store
}
github amplitude / redux-query / examples / async / src / store / configureStore.js View on Github external
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import rootReducer from '../reducers';
import { queryMiddleware } from 'redux-query';

const createStoreWithMiddleware = applyMiddleware(
  thunkMiddleware,
  queryMiddleware(state => state.queries, state => state.entities),
  createLogger(),
)(createStore);

export default function configureStore(initialState) {
  const store = createStoreWithMiddleware(rootReducer, initialState);

  if (module.hot) {
    // Enable Webpack hot module replacement for reducers
    module.hot.accept('../reducers', () => {
      const nextRootReducer = require('../reducers');
      store.replaceReducer(nextRootReducer);
    });
  }

  return store;
}