React Native With Redux : State Changes Not Showing In Console
When I put console.log('test') statements in my reducer, I can see them in the console when the actions are called. But I'm not seeing the redux 'NEXT STATE'/ 'PREV STATE' stuff in
Solution 1:
It solved when I realized that https://github.com/fcomb/redux-logger is needed to be installed separately.
Solution 2:
As you've already identified, you need to install redux-logger middleware. https://github.com/evgenyrodionov/redux-logger
From their docs:
import { applyMiddleware, createStore } from 'redux';
// Logger with default options
import logger from 'redux-logger'
const store = createStore(
reducer,
applyMiddleware(logger)
)
I only do this when in a dev environment
const middlewares = [];
if (process.env.NODE_ENV === 'dev') {
middlewares.push(logger);
}
const store = createStore(
reducer,
applyMiddleware(...middlewares)
)
Post a Comment for "React Native With Redux : State Changes Not Showing In Console"