5.0.10 • Published 6 years ago

deep-storage-react v5.0.10

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

React integration for the Deep Storage library.

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
  • Built in form support

Documentation

The Deep Storage user manual

Real World Example

See a Real World Example of deep storage react.

Demo here.

TodoMVC

See an implementation of TodoMVC that uses Deep Storage.

Installing

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

The gist of Deep Storage

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

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

2. Create a view that responds to changes in state

import { wire } 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 = wire(TimerView, {timer: storage.deep('timer')});

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

3. Modify the State

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

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

6 years ago

5.0.9

6 years ago

5.0.8

6 years ago

5.0.7

6 years ago

5.0.6

6 years ago

5.0.5

6 years ago

5.0.4

6 years ago

5.0.3

6 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

2.1.7

6 years ago

2.1.6

6 years ago

2.1.4

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.0

7 years ago