fp-ts-atom


State management solution combining fp-ts, RxJS and monocle-ts

fp-ts-atom aims to befriend RxJS and monocle-ts and provide a convenient way to manage state in a reactive way.

Inspired by @grammarly/focal


Features

  • ♨️ Any Atom is a hot Observable
  • ? Lazy initial value evaluation
  • ? Deferred source subscription
  • ? Compatible with Lens from monocle-ts
  • ? Natively extends fp-ts ecosystem
  • ? Type-safe operations
  • ? Covered by tests

Example

import * as a from 'fp-ts-atom/Atom'

const state$ = a.of(0);
state$.get(); // 0
state$.set(3);
state$.get(); // 3

API Reference

Install

Uses fp-ts, rxjs and monocle-ts as a peer dependency.

yarn add fp-ts rxjs monocle-ts fp-ts-atom

or

npm install fp-ts rxjs monocle-ts fp-ts-atom