Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass store as prop to Root component in real-world example #537

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions examples/real-world/containers/Root.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { Router, Route } from 'react-router';
import configureStore from '../store/configureStore';
import App from './App';
import UserPage from './UserPage';
import RepoPage from './RepoPage';

const store = configureStore();

export default class Root extends Component {
render() {
return (
<div>
<Provider store={store}>
<Provider store={this.props.store}>
{() =>
<Router history={this.props.history}>
<Route path='/' component={App}>
Expand Down
5 changes: 4 additions & 1 deletion examples/real-world/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import 'babel-core/polyfill';
import React from 'react';
import Root from './containers/Root';
import BrowserHistory from 'react-router/lib/BrowserHistory';
import configureStore from '../store/configureStore';

const store = configureStore();

React.render(
<Root history={new BrowserHistory()} />,
<Root history={new BrowserHistory()} store={store} />,
document.getElementById('root')
);