@tyndall/plugin-lunarx
v0.0.15
Published
Compatibility helpers for LunarX-style hooks and router APIs on top of Tyndall. This package exposes `useServerFetches`, `useSSRError`, `useSoftReload`, and re-exports Tyndall's `Link`, `useRouter`, and `useBlockRouting`.
Downloads
1,666
Readme
@tyndall/plugin-lunarx
Compatibility helpers for LunarX-style hooks and router APIs on top of Tyndall.
This package exposes useServerFetches, useSSRError, useSoftReload, and
re-exports Tyndall's Link, useRouter, and useBlockRouting.
Usage
import { createLunarxHooksPlugin, useServerFetches } from "@tyndall/plugin-lunarx";
export default {
plugins: [createLunarxHooksPlugin()],
};
export default function Page() {
const fetches = useServerFetches<{ greeting: string }>();
return <div>{fetches.data?.greeting}</div>;
}Notes
useServerFetches resolves the current route by reading the route data map
and falls back to init data when no page data is present.
