for some reason - i cannot see my reducers when i console.log(this.props). I did a purge every time i reload the app to reset this current redux state. I can't even view the INITIAL_STATE default values. Below is my HOC containing the router, provider, and persist gate. Also are the reducer (reducers/index.js) and store configuration file (store/index.js)
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import {store, persistor} from './store/index';
import { PersistGate } from 'redux-persist/integration/react';
import App from './App';
import './i18n';
persistor.purge()
console.log("purged")
ReactDOM.render(
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App/>
</PersistGate>
</Provider>,
document.getElementById('app')
);
store/index.js
import { createStore, applyMiddleware } from 'redux'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web and AsyncStorage for react-native
import rootReducer from '../reducers/index'
const persistConfig = {
key: 'primary',
storage,
}
const persistedReducer = persistReducer(persistConfig, rootReducer)
const middleware = applyMiddleware()
const store = createStore(
persistedReducer,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
middleware
)
const persistor = persistStore(store)
export {store, persistor}
reducers/index.js
import storage from 'redux-persist/lib/storage';
export const SETJWT = 'auth/login/setJWT'
let INITAL_STATE = {
JWT: 'testJWT',
currentUser: null,
isLoggingIn: false
}
const rootReducer = (state = INITAL_STATE, action) => {
switch(action.type){
case SETJWT:
return {...state, JWT: action.payload};
default:
return state;
}
}
export default rootReducer