Lens Blocks are currently in beta and not ready for production use!

Post Provider Library

A provider of a shared Lens post context for state, queries, and operations.

This library provides a React context provider component called LensPostProvider that manages and supplies Post-related data and functionalities to its child components. The Post context can be accessed using the useLensPostContext hook.

Installation

Usage

import { PostProvider } from "@/lib/lens-post-provider";
import { useSessionClient, postId } from "@lens-protocol/react";
import { useWalletClient } from "wagmi";
const session = useSessionClient();
const wallet = useWalletClient();
const post = postId("SOME_POST_ID");
<PostProvider postId={post} session={session} wallet={wallet}>
  {/* Child components that consume the post context */}
</PostProvider>