Skip to content

Instantly share code, notes, and snippets.

@txm
Created February 17, 2016 15:16
Show Gist options
  • Save txm/afda03f280c72f8a0994 to your computer and use it in GitHub Desktop.
Save txm/afda03f280c72f8a0994 to your computer and use it in GitHub Desktop.
'Could not find "store" in either the context or '
import routes from './routes.jsx';
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
{routes(store)}
</Router>
</Provider>
,mountNode);
'use strict';
import React from 'react';
import { UsernameContainer } from './../containers/username.jsx';
export const Index = React.createClass({
render: function() {
return (
<div>
<h2>Home</h2>
<UsernameContainer /> |
</div>
);
}
});
'use strict';
import React from 'react';
export const Username = React.createClass({
render: function() {
return (
<span>Username: <span className="username">TBC</span></span>
);
}
});
function Connect(props, context) {
_classCallCheck(this, Connect);
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
_this.version = version;
_this.store = props.store || context.store;
(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + _this.constructor.displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + _this.constructor.displayName + '".'));
var storeState = _this.store.getState();
_this.state = { storeState: storeState };
_this.clearCache();
return _this;
}
import { React } from 'react';
import { connect } from 'react-redux';
import { setAuthUsername } from '../actions/actions.jsx';
import { Username} from '../components/username.jsx';
export const UsernameContainer = connect(
state => ({ username: 'state.admin.username' })
// , dispatch => ({ onIncrement: () => dispatch(increment()) })
)(Username);
console.error(UsernameContainer);
export default UsernameContainer;
const routes = (
<Route path="/" component={Template} >
<IndexRoute component={Index} />
<Route path="/matrix" component={Matrix}
/>
<Route path="/clients" component={Clients} />
<Route path="/templates" component={Templates} />
<Route path="/auth" component={Auth} />
<Route path="/dimensions">
<IndexRoute component={Dimensions} />
<Route path="/dimensions/:dimension" component={ViewDimension} />
</Route>
<Route path="*" component={NotFound} />
</Route>
);
export default (store) => {
return ( routes )
};
@txm
Copy link
Author

txm commented Feb 17, 2016

Helpfully gist has rearranged the order of the file:

app.jsx
routes.jsx
components_index.jsx
containers_username.jsx --> console.log
components_username.jsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment