Skip to content

A state management solution implemented using RxJS to mimic Redux architecture.

License

Notifications You must be signed in to change notification settings

ViktorMedvedchuk/rxjs-observable-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rxjs-observable-store

npm npm MIT licensed

A state management solution implemented using RxJS to mimic Redux architecture.

Read my blog post State management in Angular with observable store services to learn more about how to use the rxjs-observable-store package to manage state in front-end applications.

Installation

npm install rxjs-observable-store --save

Usage

import {Store} from 'rxjs-observable-store';

class TestState {
    testProperty: string = 'initial value';
}

class TestStore extends Store<TestState> {
    constructor () {
        super(new TestState());
    }

    updateTestProperty (): void {
        this.setState({
            ...this.state,
            testProperty: 'updated value',
        });
    }
}

class TestComponent {
    store: TestStore;

    constructor () {
        this.store = new TestStore();

        this.store.state$.subscribe(state => {
            console.log(state);
        });

        setTimeout(() => {
            this.store.updateTestProperty();
        }, 3000);
    }
}

About

A state management solution implemented using RxJS to mimic Redux architecture.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%