Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compose-hydrate-reducers

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compose-hydrate-reducers

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

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46
increased by21.05%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 14 Dec 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc