Skip to main content
This is a thin wrapper on top of the Javascript Library, so you might want to view those docs first to familiarize yourself with the basic classes and methods.

Installation

Install with a package manager
npm install @plandalf/plandalf-react-js

Quick Usage

Step 1: Import the PlandalfProvider and usePlandalf

import { PlandalfProvider } from "@plandalf/plandalf-react-js";


function App(props) {
  return (
    <PlandalfProvider agent={props.jwt_token}>
      <MyApplication />
    </PlandalfProvider>
  )
}

Step 2:

Start using the usePlandalf hook to access the Plandalf API
import { usePlandalf } from "@plandalf/plandalf-react-js";

function MyApplication () {
  const plandalf = usePlandalf();

  if (plandalf.isWorkflowActive('my_workflow')) {
    return <MyOldPaywall/>
  }

  return (
    <MyComponent/>
  )
}