@tanstack/react-db
Version:
React integration for @tanstack/db
19 lines (18 loc) • 489 B
JavaScript
"use client";
import { useDbClient } from "./DbProvider.js";
import { useRef } from "react";
// src/HydrationBoundary.tsx
function HydrationBoundary({ state, children }) {
const client = useDbClient();
const hydrated = useRef(void 0);
if (hydrated.current?.client !== client || hydrated.current.state !== state) {
client.hydrate(state);
hydrated.current = {
client,
state
};
}
return children;
}
export { HydrationBoundary };
//# sourceMappingURL=HydrationBoundary.js.map