Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

@heartfulnessinstitute/gatsby-plugin-hfn-profile

A Gatsby plugin for react-redux with built-in server-side rendering support, mysrcm login and profile apis

Install

npm install --save @heartfulnessinstitute/gatsby-plugin-hfn-profile redux-firestore react-redux-firebase react-redux redux firebase react-firebaseui

How to use

./src/state/rootReducer.js // same path you provided in gatsby-config

function reducer(state = initialState, action) {
  //...
  switch (action.type) {
    // case SET_A:
    //  return {...state, a: action.value}
    // ...
    default:
      return state
  }
}

export default reducer

./gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-hfn-profile`,
      options: {
        // [required] - path to your rootReducer module
        pathToRootReducerModule: "./src/state/rootReducer",
        // [optional] - options passed to `serialize-javascript`
        // info: https://github.com/yahoo/serialize-javascript#options
        // will be merged with these defaults:
        serialize: {
          space: 0,
          // if `isJSON` is set to `false`, `eval` is used to deserialize redux state,
          // otherwise `JSON.parse` is used
          isJSON: true,
          unsafe: false,
          ignoreFunction: true,
        },
        // [optional] - if true will clean up after itself on the client, default:
        cleanupOnClient: true,
        // [optional] - name of key on `window` where serialized state will be stored, default:
        windowKey: "__PRELOADED_STATE__",
      },
    },
  ],
}

License

MIT

© 2023 Gatsby, Inc.