Asosiy tarkibga o'tish
import {createEvent, createStore, createEffect, combine, sample} from 'effector'

const nextPost = createEvent()

const getCommentsFx = createEffect(async postId => {
const url = `posts/${postId}/comments`
const base = 'https://jsonplaceholder.typicode.com'
const req = await fetch(`${base}/${url}`)
return req.json()
})

const $postComments = createStore([])
.on(getCommentsFx.doneData, (_, posts) => posts)

const $currentPost = createStore(1)
.on(getCommentsFx.done, (_, {params: postId}) => postId)

const $status = combine(
$currentPost, $postComments, getCommentsFx.pending,
(postId, comments, isLoading) => isLoading
? 'Post yuklanishi...'
: `Post ${postId} ${comments.length} ta komentariyaga ega`
)

sample({
source: $currentPost,
clock: nextPost,
fn: postId => postId + 1,
target: getCommentsFx,
})

$status.watch(status => {
console.log(status)
})
// => Post 1 0ta komentariyaga ega

nextPost()

// => Post yuklanishi...
// => Post 2 5ta komentariyaga ega

Ustunliklari

Tipizatsiya

Tipizatsiya

TypeScript ni to`la ta`minotini qo`llaydi

Freymvorklardan mustaqil

Freymvorklardan mustaqil

Har qanday UI va server freymvorklar bilan ishlay oladi

Dasturchilar uchun qulay

Dasturchilar uchun qulay

Mantiqiy API va do`stona hamjamiyat

Maksimal ishlash

Maksimal ishlash

Statik ishga tushishi ish faoliyatini tezlashtiradi

Kichik hajim

Kichik hajim

Effector TREE SHAKING ni qo`llaydigan ixcham biblioteka

Oddiy JavaScript

Oddiy JavaScript

Hechqanday proksi va klasslarsiz

Effector dan foydalanayotkan kompaniyalar

Aviasales
Health Samurai
Raiffeisen Bank Russia
UNICEF (United Nations Children’s Fund)
Joom Group
Sber
Avito
MTS
Docsvision
Okoo
space307
REDMADROBOT
Travelpayouts
Junto
automation hero
Radity
Global CTO Forum
Express24
StellarX
STM Labs
TenPixls
Uptarget
смартомато
Фоксфорд
Codengage
Lunatask
Semrush
Intouch Health, a Teladoc company
Bu ro'yxatda bolishni istaysizmi? Bizga habar bering