Using your store

Once your store is created, and you have extracted your tables, singles, and queues, you can import them into your components for interaction.

component.tsx
import { tables } from './store';

function MyComponent() {
    const rows = tables.activeTasks.use();

    return (
        <div>
            There are {rows.length} active tasks in the table
        </div>
    )
}

Trigger uses React hooks internally, which makes it easy to integrate the store into your application. In the above example, we simply need to import the tables property from our store which has all of our tables namespaced and ready to use. When using TypeScript you will also be provided with type hints about the properties your table contains.

The same table can be used in multiple components, which allows you to control which components need to update when there is a change to the underlying table.

Built with in Halifax, Nova Scotia by JW