UNPKG

@croct/plug-react

Version:

React components and hooks to plug your React applications into Croct.

16 lines (15 loc) 417 B
"use client"; import { useContext } from "react"; import { CroctContext } from "../CroctProvider.js"; function useCroct() { const context = useContext(CroctContext); if (context === null) { throw new Error( "useCroct() can only be used in the context of a <CroctProvider> component. For help, see https://croct.help/sdk/react/missing-provider" ); } return context.plug; } export { useCroct };