UNPKG

nextjs-airflex

Version:

A Next.js-compatible wrapper for reactjs-airflex.

68 lines (56 loc) 991 B
## Get started ## 📚 Requirement Contact Airflex Admin to get Key > Note: Key required for authorization ## 📦 Install ```yaml npm i nextjs-airflex ``` or ```yaml yarn add nextjs-airflex ``` ## 🔨 Usage Create components/Airflex.tsx ```tsx "use client"; import React, { useEffect } from "react"; import { airflex } from "nextjs-airflex"; export default function Airflex() { useEffect(() => { if (airflex) { airflex.create("xxxx", {devmode: true}); } }, []); /* xxxx: key airflex devmode: boolean */ return <div />; }); ``` Import component Airflex into app/layout.tsx ```tsx import Airflex from "@/components/Airflex"; export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { return ( <html> <body> {children} <Airflex /> </body> </html> ); } ``` ### Log event ```yaml AirflexJS.logEvent("event_name"); ``` ```yaml AirflexJS.logEvent("event_name", data); ```