XMTP Support – frames.js
Cross-protocol frames are supported by frames.js via familiar APIs. This guide will showcase how to write a simple stateless frame, which returns the identity of the user that interacted with the frame in Farcaster or an XMTP chat. First, you need to install frames.js and @xmtp/frames-validator. You can do this by running the following command: To write a frame using Next.js, we need to create a page which renders the frame and a route which handles frame action requests. We start by creating a new API route which will handle POST requests to our frame. In your Next.js project, create a new directory /frames and inside it, create a route.ts file which contains the following code: This will handle POST requests to our frame and redirect them to page we are about to create, which will handle the rendering logic. In your Next.js project, create a new page.tsx at the root of the project and write the following code: First import the necessary functions and components from frames.js: FrameB
Cross-protocol frames are supported by frames.js via familiar APIs. This guide will showcase how to write a simple stateless frame, which returns the identity of the user that interacted with the frame in Farcaster or an XMTP chat. This tutorial is out of date and uses a deprecated version of frames.js. Please check the XMTP Support guide for the latest version. Setup First, you need to install frames.js and @xmtp/frames-validator . You can do this by running the following command: npm pnpm yarn npm install frames.js @xmtp/frames-validator Writing a Frame To write a frame using Next.js, we nee
saved by
related reading
- Navigating the future of frontendfrontendmastery.com
- Getting Started: Error Handling | Next.jsnextjs.org
- next.js/examples at canary · vercel/next.jsgithub.com
- File-system conventions: loading.js | Next.jsnextjs.org
- App Router: Streaming | Next.jsnextjs.org
- React Foundations | Next.jsnextjs.org
- Next.js Docsnextjs.org
- Guides: Forms | Next.jsnextjs.org
- The new wave of Javascript web frameworksfrontendmastery.com
- API Reference: Edge Runtime | Next.jsnextjs.org
- Getting Started: Layouts and Pages | Next.jsnextjs.org
- Building a single-page application with Next.js and React Routercolinhacks.com