user3554382 user3554382 - 1 year ago 248
Javascript Question

React Redux MapStateToProps

Why do I get

returned when I access the state? I use the Redux DevTools and see the state correctly updated via an action but I just cannot access the state values for some reason. I get this sort of object returned when I access
which seems wrong:

ct {size: 1, _root: pt, __ownerID: undefined, __hash: undefined, __altered: false}

Here is my container code:

import { connect } from 'react-redux';
import Message from '../../components/message';

const mapStateToProps = (state) => {
return {
message: ? 'Barked' : 'It is quiet',

export default connect(mapStateToProps)(Message);

Here is the dog reducer:

import * as Immutable from 'immutable';
import { MAKE_BARK } from '../actions/dog';

const initialState = Immutable.Map({
hasBarked: false,

const dogReducer = (state: Object = initialState, action: Object) => {
switch (action.type) {
return state.set('hasBarked', action.payload);
return state;

export default dogReducer;

Answer Source

Seems like you are using immutable. is not a simple js array but a immutable map or list. You can access it natively with

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download