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

redux-immutable

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-immutable

redux-immutable is used to create an equivalent function of Redux combineReducers that works with Immutable.js state.

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is redux-immutable?

The redux-immutable package is designed to work with Redux and Immutable.js, providing a way to use an Immutable.js Map as the root of your Redux state. This allows you to leverage the benefits of Immutable.js, such as structural sharing and efficient updates, while still using Redux for state management.

What are redux-immutable's main functionalities?

combineReducers

The combineReducers function from redux-immutable allows you to combine multiple reducers into a single reducer function, with the root state being an Immutable.js Map. This is similar to Redux's combineReducers but works with Immutable.js.

const { combineReducers } = require('redux-immutable');
const { Map } = require('immutable');
const { createStore } = require('redux');

const fooReducer = (state = 'foo', action) => state;
const barReducer = (state = 'bar', action) => state;

const rootReducer = combineReducers({
  foo: fooReducer,
  bar: barReducer
});

const initialState = Map();
const store = createStore(rootReducer, initialState);

console.log(store.getState().toJS());

getIn

The getIn method allows you to access nested properties within the Immutable.js Map. This is useful for deeply nested state structures, providing a convenient way to retrieve values.

const { combineReducers } = require('redux-immutable');
const { Map } = require('immutable');
const { createStore } = require('redux');

const fooReducer = (state = Map({ value: 'foo' }), action) => state;
const barReducer = (state = Map({ value: 'bar' }), action) => state;

const rootReducer = combineReducers({
  foo: fooReducer,
  bar: barReducer
});

const initialState = Map();
const store = createStore(rootReducer, initialState);

console.log(store.getState().getIn(['foo', 'value']));

Other packages similar to redux-immutable

Keywords

FAQs

Package last updated on 14 Mar 2017

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