import {createStore, createEvent} from 'effector'
const add = createEvent()
const sub = createEvent()
const reset = createEvent()
const counter = createStore(0)
.on(add, (count, n) => count + n)
.on(sub, (count, n) => count - n)
.reset(reset)
counter.watch(n => console.log('counter:', n))
// counter: 0
add.watch(n => console.log('add', n))
sub.watch(n => console.log('subtract', n))
reset.watch(() => console.log('reset counter'))
add(5)
// add 5
// counter: 5
sub(1)
// subtract 1
// counter: 4
reset()
// reset counter
// counter: 0

Effector

The state manager

Image

Type safe

TypeScript and Flow support out of box.

Image

Framework agnostic

Can work with any UI or server framework.

Image

Developer-friendly

Simple API surface and helpful community.

Image

Maximum performance

Static initialization provides boost in performance for runtime.

Image

Tiny bundle size

Effector uses Rollup and Terser to provide small builds.

Image

Plain javascript

No decorators, no proxies, no classes required. Only you and your data.