Skip to content

Instantly share code, notes, and snippets.

@Kelin2025
Last active May 8, 2022 04:04
Show Gist options
  • Save Kelin2025/ba10d20e9b6351959b70899e5ccd6b12 to your computer and use it in GitHub Desktop.
Save Kelin2025/ba10d20e9b6351959b70899e5ccd6b12 to your computer and use it in GitHub Desktop.
import { createStore } from 'effector'
// Simple stores
const $todo = createStore('')
const $todos = createStore([])
// Use store.map(state => computedState)
// To create computed stores
const $todosCount = $todos.map(todos => todos.length)
const $completedTodos = $todos.map(todos => todos.filter(todo => todo.completed))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment