i'm trying implement redux immutable in my project but i got stuck at connect mapStateToProps because the state returned from redux is Map object from ImmutableJS and i can not access user property also other properties in state by state.user or state.get('user') . So i posted my code here and need some advice from you guys, thanks in advance! Here is my code:
folder: store/configureStore.js
"use strict";
import {applyMiddleware, createStore} from 'redux';
import thunk from 'redux-thunk';
var promise = require('./promise');
var array = require('./array');
import rootReducers from '../reducers';
var createLogger = require('redux-logger');
var {AsyncStorage} = require('react-native');
import Immutable from 'immutable';
var isDebuggingInChrome = __DEV__ && !!window.navigator.userAgent;
const initialState = Immutable.Map({
user: {
isLoggedIn: false,
username: null,
session_id: null,
name: null,
uid: null
}
});
var logger = createLogger({
predicate: (getState, action) => isDebuggingInChrome,
collapsed: true,
duration: true,
});
var createCassiStore = applyMiddleware(thunk, promise, array, logger)(createStore)
function configureStore(onComplete: ?()=> void) {
const store = createCassiStore(rootReducers, initialState);
if (isDebuggingInChrome) {
window.store = store;
}
return store;
}
module.exports = configureStore;
Hi guys,
i'm trying implement redux immutable in my project but i got stuck at connect mapStateToProps because the state returned from redux is Map object from ImmutableJS and i can not access user property also other properties in state by
state.user
orstate.get('user')
. So i posted my code here and need some advice from you guys, thanks in advance! Here is my code:folder: store/configureStore.js
folder: reduders/user.js
folder reducers/index.js
folder components/MyNavigator.js