Skip to main content

Iniz

A reactive state library

import { atom, store } from "@iniz/react";

interface Todo {
completed: boolean;
title: string;
}

export const newTodo = atom("");
export const todos = store<Todo[]>([]);

export function addTodo(title: string) {
newTodo("");
todos.unshift({ title, completed: false });
}
export function removeTodo(todo: Todo) {
todos.splice(todos.indexOf(todo));
}