1.0.0-alpha.0 • Published 1 year ago

live-model v1.0.0-alpha.0

Weekly downloads
8
License
MIT
Repository
github
Last release
1 year ago

Live Model

Live Model provides a local cache to your API or remote database, so that your app responds immediately, whether your user has gigabit internet, an unstable connection, or is offline!

Installation

npm install live-model@alpha

Usage

⚠️  Under development!

import { liveTable } from "live-model";
import { useQuery } from "live-model/react";

interface ToDo {
    id: string;
    title: string;
}

const todosTable = liveTable<ToDo>("todos");

export function App() {
    const todos = useQuery(todosTable);
    return (
        <div>
            <ul>
                {todos.map((todo) => (
                    <li key={todo.id}>{todo.title}</li>
                ))}
            </ul>
            <button onClick={() => todosTable.add({ title: "New" })}>
                Create To-Do
            </button>
        </div>
    );
}

Licence

MIT

1.0.0-alpha.0

1 year ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago