Using your store
Once your store is created, you can import it into your components for interaction.
component.tsximport { store } from './store';
function MyComponent() {
const rows = store.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 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.