mapStateToProps must return an object. Instead received undefined
<p>I'am using react with redux on the frontend and calling elixir phoenix backend API.
Everything seems to work but i have this error in my javascript console</p>

<p><code>Error: mapStateToProps must return an object. Instead received undefined.</code></p>

<p>I have implemented the redux logger and this is the objects as seen from him
<a href="http://i.stack.imgur.com/VDPRR.png" rel="nofollow">ReduxLog</a></p>

<p>I can not see anything incorrect there, after the action the objects are all correct. I can see in phoenix that the user has both joined the socket and the channel.</p>

<p>since this error seems to be around <code>mapStateToProps</code> I had a better look at that code</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react';
import {
  connect
}
from 'react-redux';

class AuthenticatedContainer extends React.Component {
  componentDidMount() {
    const {dispatch} = this.props;
  }

  render() {
    const {currentUser, dispatch, socket} = this.props;
    if (!currentUser) return false;
    return ( &lt; div id = "authentication_container"
      className = "application-container" &gt;
      &lt; div className = "main-container" &gt; {
        this.props.children
      } &lt; /div&gt;
            &lt;/div &gt;
    );
  }
}

const mapStateToProps = (state) =&gt; ({
  currentUser: state.session.currentUser,
  socket: state.session.socket,
  channel: state.session.channel,
});
export
default connect(mapStateToProps)(AuthenticatedContainer);</code></pre>
</div>
</div>
</p>

<p>here is then the session reducer</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import Constants from '../constants';

const initialState = {
    currentUser: null,
    socket: null,
    channel: null,
    error: null,
};

export default function reducer(state = initialState, action = {}) {
    console.log(action)
    switch(action.type) {
        case Constants.CURRENT_USER:
            return { ...state, currentUser: action.currentUser, socket: action.socket, channel: action.channel};

        case Constants.USER_SIGNED_OUT:
            return initialState;

        case Constants.SESSIONS_ERROR:
            return { ...state, error: action.error };

        default:
            return state;
    }
}</code></pre>
</div>
</div>
</p>

<p>and the combined reducer</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { combineReducers }  from 'redux';
import { routerReducer }     from 'react-router-redux';
import session              from './session';
import registration         from './registration';

export default combineReducers({
    routing: routerReducer,
    session: session,
    registration: registration,
});</code></pre>
</div>
</div>
</p>

<p>When i go through my code and try to debug I can not find any instance when the state is undefined for those props.
I'am using a lot of code from <a href="https://github.com/bigardone/phoenix-trello" rel="nofollow">https://github.com/bigardone/phoenix-trello</a>.</p>

<p>All help will be greatly appreciated.</p>

<p>Best regards
Björn</p>