Use Lens Post Context

PreviousNext

A hook for state, queries, and operations in a shared Lens post context

Docs
lens-blockshook

Preview

Loading preview…
registry/new-york/hooks/use-lens-post-context.tsx
import { useContext } from "react";
import { LensPostContext } from "@/registry/new-york/lib/lens-post-provider";

export const useLensPostContext = () => {
  const context = useContext(LensPostContext);
  if (!context) {
    throw new Error("useLensPostContext must be used within a PostProvider");
  }
  return context;
};

Installation

npx shadcn@latest add @lens-blocks/use-post-context

Usage

import { UsePostContext } from "@/hooks/use-post-context"
const value = UsePostContext()