How to use the @uppy/store-redux.reducer function in @uppy/store-redux

To help you get started, we’ve selected a few @uppy/store-redux 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 transloadit / uppy / examples / redux / main.js View on Github external
function counter (state = 0, action) {
  switch (action.type) {
    case 'INCREMENT':
      return state + 1
    case 'DECREMENT':
      return state - 1
    default:
      return state
  }
}

const reducer = combineReducers({
  counter: counter,
  // You don't have to use the `uppy` key. But if you don't,
  // you need to provide a custom `selector` to the `uppyReduxStore` call below.
  uppy: uppyReduxStore.reducer
})

let enhancer = applyMiddleware(
  uppyReduxStore.middleware(),
  logger
)
if (window.__REDUX_DEVTOOLS_EXTENSION__) {
  enhancer = compose(enhancer, window.__REDUX_DEVTOOLS_EXTENSION__())
}

const store = createStore(reducer, enhancer)

// Counter example from https://github.com/reactjs/redux/blob/master/examples/counter-vanilla/index.html
const valueEl = document.querySelector('#value')

function getCounter () { return store.getState().counter }

@uppy/store-redux

Make Uppy use your existing Redux store.

MIT
Latest version published 2 months ago

Package Health Score

92 / 100
Full package analysis

Popular @uppy/store-redux functions