Socket
Socket
Sign inDemoInstall

compose-hydrate-reducers

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    compose-hydrate-reducers

Automatically handles the `HYDRATE` action executed by next-redux-wrapper.


Version published
Maintainers
1
Install size
533 kB
Created

Readme

Source

Compose Hydrate Reducers for Redux Wrapper

Automatically handles the HYDRATE action executed by next-redux-wrapper.

Installation

The easiest way to install compose-hydrate-reducers is with npm.

npm install compose-hydrate-reducers

Alternately, download the source.

git clone https://github.com/stegano/compose-hydrate-reducers.git

Implementation

  • Overwrite the client side state to the state delivered from the server side When the page is first rendered.

Example

// store.ts
...
const reducers = combineReducers(
  /**
   * Reducers with `HYDRATE` action handling added is returned. 
   * ✨ Now you don't have to handle the `HYDRATE' operation directly on each reducer.
   */
  composeHydrateReducers({
    yourReducer1,
    yourReducer2
    ...
  });
)

type RootState = ReturnType<typeof reducers>;

// create a makeStore function
const makeStore = () => createStore(reducers);

// export an assembled wrapper
export const wrapper = createWrapper<Store<RootState>>(makeStore, { debug: true });
...

Keywords

FAQs

Last updated on 14 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc