react redux middleware app example
Example 1: react redux middleware
const loggingMiddleware = function(store) {
return function(next) {
return function(action) {
}
}
}
Example 2: react redux middleware
import * as types from './types';
export const initialState = {
currentTime: new Date().toString(),
}
export const reducer = (state = initialState, action) => {
switch(action.type) {
case types.FETCH_NEW_TIME:
return { ...state, currentTime: action.payload}
default:
return state;
}
}
export default reducer