@ramifyjs/react-hooks
v0.0.4
Published
React hooks for Ramify JS - the reactive, in-memory database.
Maintainers
Readme
@ramifyjs/react-hooks
React hooks for Ramify JS - the reactive, in-memory database.
Seamlessly integrate Ramify JS into your React applications with live query observers that automatically re-render components when data changes.
Install
npm install @ramifyjs/react-hooks @ramifyjs/core
# or
pnpm add @ramifyjs/react-hooks @ramifyjs/core
# or
yarn add @ramifyjs/react-hooks @ramifyjs/coreUsage
import { useLiveQuery } from '@ramifyjs/react-hooks';
import { db } from './db'; // Your Ramify instance
function UserList() {
const users = useLiveQuery(() => db.users.toArray(), { collections: [db.users], others: [] });
return (
<ul>
{users.map((user) => (
<li key={user.id}>{user.name}</li>
))}
</ul>
);
}Features
- Live Queries: Automatically re-render components on data updates.
- Type-safe: Full TypeScript support.
- Simple API: Easy to use
useLiveQueryhook.
