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

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.