title: Possible Unhandled Promise Rejection (id:0): undefined is not an object
body: <p>I have React Native App with Redux and I'm trying to fetch data from Redux in component's constructor.
  I'm getting error like this:
  Possible Unhandled Promise Rejection (id:0): undefined is not an object (evaluating 'library.activeSections')</p>
  
  <p>here is my code:</p>
  
  <pre><code>class Accordion extends Component {
  ...
  
  constructor (props) {
  super(props)
  this.state = {
    activeSections: [this.props.initiallyActiveSection]
  }
  
  // if activeSection not specified, default to initiallyActiveSection
  let { library } = this.props  
  if (library.activeSections) {  //&lt;-- here is an error library is undefined
    this.setState({activeSections: library.activeSections})
  }
  
   _toggleSection (section) {
  const activeSection = section
      let isOpened = this.state.activeSections.indexOf(section) &gt;= 0 ? true : false
      var indexInActiveSections = this.state.activeSections.indexOf(section)
  if (isOpened === true) {
        this.state.activeSections.splice(indexInActiveSections, 1)
      } else {
        this.state.activeSections.push(section)
      }
  
      this.props.libraryActions.setActiveSections(this.state.activeSections)
  
      this.setState({ activeSection })
      }
  
      render () {
  ...
  }
  
  }
  
      Accordion.PropTypes = {
    library: React.PropTypes.arrayOf(React.PropTypes.number)
  }
  
  export default connect(state =&gt; ({
      library: state.library
    }),
    (dispatch) =&gt; ({
      libraryActions: bindActionCreators(libraryActions, dispatch)
    })
  )(Accordion)
  
  module.exports = Accordion
  </code></pre>
  
  <p>here is library reducer reducers/library.js:</p>
  
  <pre><code>    import { Map } from 'immutable'
  
  const initialState = Map({
    activeSections: [0]
  })
  
  export default function library (state = initialState, action = {}) {
    switch (action.type) {
      case 'SET_ACTIVE_SECTIONS':
        return {
          ...state,
          activeSections: action.activeSections
        }
      default:
        return state
    }
  }
  </code></pre>
  
  <p>and here is library action actions/library.js:</p>
  
  <pre><code>    export const setActiveSections = (activeSections) =&gt; {
    return {
      type: 'SET_ACTIVE_SECTIONS',
      activeSections
    }
  }
  </code></pre>
  
  <p>here is reducers/index.js:</p>
  
  <pre><code> import articles from './articles'
  import journal from './journal'
  import library from './library'
  
  export {
    articles,
    journal,
    library
  }
  </code></pre>
  
  <p>I can't understand why there is no library object in this.props</p>
  
  <p>Hope for your help.</p>