Created
February 17, 2016 15:16
-
-
Save txm/afda03f280c72f8a0994 to your computer and use it in GitHub Desktop.
'Could not find "store" in either the context or '
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import routes from './routes.jsx'; | |
ReactDOM.render( | |
<Provider store={store}> | |
<Router history={browserHistory}> | |
{routes(store)} | |
</Router> | |
</Provider> | |
,mountNode); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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> | |
); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import React from 'react'; | |
export const Username = React.createClass({ | |
render: function() { | |
return ( | |
<span>Username: <span className="username">TBC</span></span> | |
); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Helpfully gist has rearranged the order of the file:
app.jsx
routes.jsx
components_index.jsx
containers_username.jsx --> console.log
components_username.jsx