use redux in gatsby

Solutions on MaxInterview for use redux in gatsby by the best coders in the world

showing results for - "use redux in gatsby"
Yohan
30 Jun 2017
1npm install --save gatsby-plugin-react-redux react-redux redux
2
3// 
4yarn add gatsby-plugin-react-redux react-redux redux
5
6// How to use
7// same path you provided in gatsby-config
8// ./src/state/createStore.js 
9
10import { createStore } from 'redux';
11
12function reducer() {
13  //...
14}
15
16// preloadedState will be passed in by the plugin
17export default preloadedState => {
18  return createStore(reducer, preloadedState);
19};