Skip to content

Could not find "store" in either the context or props #57

@anthonator

Description

@anthonator

I get a Could not find "store" in either the context or props error whenever I try to connect a component to Redux.

When I'm in the debug console I can see that state is defined on this and context but it has a value of undefined. Also, when I inspect createStore I get an object back with dispatch, getState, etc.

import { Provider } from 'react-redux';
import React from 'react';
import reducers from '../config/reducers';
import { createStore } from 'redux';
import routes from '../config/routes';

React.render(
  <Provider store={ createStore(reducers) }>
    { () => routes }
  </Provider>
, document.body);

Component

import React from 'react';

// components
import Footer from './_footer';
import Header from './_header';

// redux
import { connect } from 'react-redux';

import ClientSessionActionCreators from '../../actions/client-session-action-creators';

class ApplicationLayout extends React.Component {
  render() {
    return (
      <div>
        <Header />
        { this.props.children }
        <Footer />
      </div>
    );
  }
}

export default connect(state => state)(ApplicationLayout);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions