@toba/state
TypeScript icon, indicating that this package has built-in type declarations

2.1.3 • Public • Published

npm package Build Status Code style Dependencies DevDependencies Test Coverage

Toba State

Flux pattern state management.

Usage

yarn add @toba/state

Example

import React from 'react';
import { State, StateStore, flux } from '@toba/state';

export interface UserState extends State {
   notifications: string[];
   signedIn: boolean;
   fullName?: string;
   photoURL?: string;
   status: Status;
}

class Store extends StateStore<UserState> {
   constructor() {
      super({
         notifications: [] as string[],
         signedIn: false,
         status: null
      });
   }
}

export const userStore = flux.subscribe(new Store());

License

Copyright © 2019 Jason Abbott

This software is licensed under the MIT license. See the LICENSE file accompanying this software for terms of use.

Readme

Keywords

none

Package Sidebar

Install

npm i @toba/state

Weekly Downloads

2

Version

2.1.3

License

MIT

Unpacked Size

22.5 kB

Total Files

13

Last publish

Collaborators

  • jason-abbott