DecaneDocs
Get startedFramework setup
Get started

Framework setup

Client components are required for all hooks. Wrap DecaneKit in a "use client" boundary so the server layout stays a server component.

tsxsrc/components/Providers.tsx
"use client";

import { DecaneKit } from "decane-connect-kit";
import type { ReactNode } from "react";

export function Providers({ children }: { children: ReactNode }) {
  return (
    <DecaneKit config={{ theme: "auto" }}>
      {children}
    </DecaneKit>
  );
}
tsxsrc/app/layout.tsx
import { Providers } from "@/components/Providers";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}

Add "use client" to every component that uses a decane hook.

Add transpilePackages to next.config.ts:

tsnext.config.ts
const nextConfig = {
  transpilePackages: ["decane-connect-kit"],
};

No extra config needed. Wrap your root component with <DecaneKit> and use hooks anywhere inside it.

tsxsrc/main.tsx
import ReactDOM from "react-dom/client";
import { DecaneKit } from "decane-connect-kit";
import App from "./App";

ReactDOM.createRoot(document.getElementById("root")!).render(
  <DecaneKit config={{ theme: "auto" }}>
    <App />
  </DecaneKit>
);