Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 }