Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

immutable-state-helper

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-state-helper

Immutable.js helper functions for React.js

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

immutable-state-helper

Helper function for setState pattern

https://github.com/facebook/immutable-js/wiki/Immutable-as-React-state#helper-function-for-setstate-pattern

Example

import { Map } from 'immutable;
import React from 'react';
import { createImmState } from 'immutable-state-helper';

class Example extends React.Component {

  ...

  onFooChange(value) {
    this.setImmState(
      updater => updater.set('foo', value)
    );
  }

  constructor(props) {
    super(props);

    this.state = {
      immData: Map({
        foo: '',
        bar: ''
      })
    }

    this.setImmState = createImmState(this, 'immData');
  }

  render() {
    const { immData } = this.state;

    return <div>{ immData.get('foo', '') }</div>;
  }
}

Keywords

immutable

FAQs

Package last updated on 07 Aug 2015

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