Todo work
Some checks failed
Lint / lint (push) Failing after 10s

This commit is contained in:
Julien Valverdé
2025-01-15 20:09:00 +01:00
parent f3f44d9abe
commit 3813e63982
11 changed files with 153 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
import { Effect, Stream } from "effect"
import { Reffuse } from "../reffuse"
import { TodosState } from "../services"
export function VTodos() {
// Sync changes to the todos with the local storage
Reffuse.useFork(TodosState.TodosState.pipe(
Effect.flatMap(state =>
Stream.runForEach(state.todos, () => state.saveToLocalStorage)
)
))
const todosRef = Reffuse.useMemo(TodosState.TodosState.pipe(Effect.map(state => state.todos)))
const [todos] = Reffuse.useRefState(todosRef)
return <></>
}