"But I don't want to go among mad people," Alice remarked.
"Oh, you can't help that," said the Cat: "we're all mad here. I'm mad. You're mad."
"How do you know I'm mad?" said Alice.
"You must be," said the Cat, "or you wouldn't have come here."
— Lewis Carroll, "Alice's Adventures in Wonderland"

QueryMe, dev

State flows where it needs to go like it has its own compass

qume.dev
// Define your events
type TodoEvent = 
  | { type: 'TODO_CREATED', id: string, title: string }
  | { type: 'TODO_COMPLETED', id: string }

const { query, action, store } = scope<TodoEvent>()

const todoStore = store({
  // call this to make todos
  create: action(title => ({ type: 'TODO_CREATED', id: uuid(), title })),
  complete: action(id => ({ type: 'TODO_COMPLETED', id })),
  // this updates itself when you create todos
  todos: query('TODO_CREATED').by.id
  // shows only todos that haven't been completed yet
  active: query('TODO_CREATED').by.id
    .join(query('TODO_COMPLETED').by.id.optional())
    .filter(([todo, completed]) => !completed)
    .map(([todo]) => todo)
})