@hellomonday/state

A simple module for state management

Usage no npm install needed!

<script type="module">
  import hellomondayState from 'https://cdn.skypack.dev/@hellomonday/state';
</script>

README

@hellomonday/state

A simple module for state management. Add key/value pairs and listen to changes on the key's value.

Install

$ npm install --save @hellomonday/state

Usage

  const CURRENT_SECTION = 'currentSection';
  const state = new State();

  state.on(CURRENT_SECTION, async (state: any) => {
    // The state will return 'current' and 'previous' values
    state.previous.animateOut();
    state.current.animateIn();
  });

  state.setValue(CURRENT_SECTION, new Home());

License

MIT © Hello Monday