gatsby-plugin-react-redux
A Gatsby plugin for
react-redux with
built-in server-side rendering support.
Install
npm install --save gatsby-plugin-react-redux react-redux redux
How to use
./src/state/createStore.js
// same path you provided in gatsby-config
import { createStore } from 'redux';
function reducer() {
}
export default preloadedState => {
return createStore(reducer, preloadedState);
};
./gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-react-redux`,
options: {
pathToCreateStoreModule: './src/state/createStore',
serialize: {
space: 0,
isJSON: true,
unsafe: false,
ignoreFunction: true,
},
cleanupOnClient: true,
windowKey: '__PRELOADED_STATE__',
},
},
],
};
License
MIT