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

Type safe

Type safe

TypeScript and Flow support out of box.

Framework agnostic

Framework agnostic

Can work with any UI or server framework.

Developer-friendly

Developer-friendly

Simple API surface and helpful community.

Maximum performance

Maximum performance

Static initialization provides boost in performance for runtime.

Tiny bundle size

Tiny bundle size

Effector uses Rollup and Terser to provide small builds.

Plain javascript

Plain javascript

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