Skip to content

Instantly share code, notes, and snippets.

@glommer
Created July 19, 2022 00:06
Show Gist options
  • Save glommer/e1e5ee937fc7b654884966561407feca to your computer and use it in GitHub Desktop.
Save glommer/e1e5ee937fc7b654884966561407feca to your computer and use it in GitHub Desktop.
const todos = useSubscribe(rep, async tx => {
return await tx.scan({prefix: 'todo/'}).toArray();
});
return (
<ul>
{todos.map(todo => (
<li key={todo.id}>{todo.text}</li>
))}
</ul>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment