+
Multiple provider-example
+
Redux component:
+
+ ReduxState:
+ {JSON.stringify(this.props.reduxState)}
+
+
Apollo
+
List (click on something)
+
+ {({ loading, error, data }) => {
+ if (loading) return Loading...
+ if (error) return Error :(
+
+ return (
+
+ {data.blogPosts.map(data => {
+ const { id, title } = data
+ return (
+ - {
+ this.props.setBlogPost(data)
+ }}
+ key={id}
+ >
+ {title}
+
+ )
+ })}
+
+ )
+ }}
+
+ {this.props.reduxState.id && (
+
+ {({ loading, error, data }) => {
+ if (loading) return Loading...
+ if (error) return Error :(
+
+ return (
+ <>
+ Details {data.blogPost.title}
+ {data.blogPost.post}
+ >
+ )
+ }}
+
+ )}
+
+ )
+ }
+}
+
+const mapStateToProps = state => {
+ return { reduxState: state }
+}
+
+const mapDispatchToProps = dispatch => {
+ return {
+ setBlogPost: blogPost =>
+ dispatch({ type: `SET_BLOG_POST`, payload: blogPost }),
+ }
+}
+
+const ReduxConnectedIndexPage = connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(IndexPage)
+
+export default injectSheet(styles)(ReduxConnectedIndexPage)
diff --git a/examples/using-redux/gatsby-browser.js b/examples/using-redux/gatsby-browser.js
index dd8cbdd2bc212..11a9e4b298258 100644
--- a/examples/using-redux/gatsby-browser.js
+++ b/examples/using-redux/gatsby-browser.js
@@ -1,16 +1,2 @@
-import React from "react"
-import { Provider } from "react-redux"
-
-import createStore from "./src/state/createStore"
-
-const store = createStore()
-
-export const wrapRootComponent = ({ Root }) => {
- const ConnectedRootComponent = () => (
-