Effector

Effector

  • Docs
  • Try
  • API
  • Blog
  • Twitter
  • GitHub

›effector

effector

  • API Reference
  • Event
  • Store
  • Effect
  • Domain
  • createStore
  • createEvent
  • createEffect
  • createDomain
  • createStoreObject
  • combine
  • restore
  • createApi
  • clearNode
  • merge
  • split
  • sample
  • guard
  • forward
  • fromObservable

effector-react

  • API Reference
  • useStore
  • useStoreMap
  • useList
  • createComponent
  • Gate
  • createGate
  • useGate
  • createStoreConsumer

effector-vue

  • API Reference
  • VueEffector
  • ComponentOptions
  • Vue
Edit

combine(...stores, fn)

Creates a new store that emits the set of latest store values from all input stores

Returns

(Store): An object that holds the state tree. There can be multiple stores.

Example

const balance = createStore(0)
const username = createStore('zerobias')

const greeting = combine(balance, username, (balance, username) => {
  return `Hello, ${username}. Your balance is ${balance}`
})

greeting.watch(data => console.log(data)) // => Hello, zerobias. Your balance is 0

const arrStores = combine(balance, username)
arrStore.watch(console.log) // => [0, 'zerobias']

combine({ A, B, C }, fn?)

Creates a new store that emits the set of latest store values from all input stores

Returns

(Store): An object that holds the state tree. There can be multiple stores.

Example

const r = createStore(255)
const g = createStore(0)
const b = createStore(255)

const color = combine({r, g, b})
color.watch(console.log) // => {r: 255, b: 0, b: 255}

const sum = combine({r, g, b}, ({r, g, b}) => r + g + b)
sum.watch(console.log) // => 510

combine([A, B, C], fn?)

Returns

(Store): An object that holds the state tree. There can be multiple stores.

Example

const r = createStore(255)
const g = createStore(0)
const b = createStore(255)

const color = combine([r, g, b])
color.watch(console.log) // => [255, 0, 255]

const sum = combine({r, g, b}, ([r, g, b]) => r + g + b)
sum.watch(console.log) // => 510
← createStoreObjectrestore →
Effector
Docs
Getting StartedAPI Reference
Community
User ShowcaseStack OverflowGitterTwitter
More
GitHubStar
Copyright © 2019 zerobias