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

deep-storage

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-storage

Simple observable state management for reactive applications

  • 0.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
increased by250%
Maintainers
1
Weekly downloads
 
Created
Source

Deep Storage provides observable state for reactive applications in JavaScript.

Key features

  • Simple to use observable state management
  • Optimised for use with React
  • No global state
  • Simple way to manage shared state with or without a fully fledged flux pattern

Documentation

The Deep Storage user manual

TodoMVC

See an implementation of TodoMVC that uses Deep Storage.

Installing

npm install deep-storage # or yarn install deep-storage

The gist of Deep Storage

1. Create a new Deep Storage instance and initialise its state

import deepStorage from 'deep-storage';

const storage = deepStorage({
    timer: 0
});

2. Create a view that responds to changes in state

import {deep} from 'deep-storage-react';

class TimerView extends React.Component {
    render() {
        return (
            <button onClick={this.onReset.bind(this)}>
                Seconds passed: {this.props.timer}
            </button>
        );
    }
    onReset () {
        this.props.resetTimer();
    }
};

const DeepTimerView = deep({timer: storage.deep('timer')})(TimerView);

ReactDOM.render((
    <DeepTimerView resetTimer={resetTimer}/>
), document.body);

3. Modify the State

function resetTimer() {
    storage.setIn('timer')(0);
}

setInterval(function tick() {
    storage.updateIn('timer')(prev => prev + 1);
}, 1000);

FAQs

Package last updated on 07 Aug 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