npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@whop/react

v0.3.0

Published

React SDK for building embedded apps on Whop

Downloads

7,554

Readme

@whop/react

Whop Apps react SDK helps you get started with Whop Apps and react. It offers easy entry points into many features.

Setup

Mount the WhopApp provider at the highest possible level. The WhopApp provider handles mounting the WhopThemeScript, WhopIframeSdkProvider and Theme components.

import { WhopApp } from "@whop/react";

export default function RootLayout({
	children,
}: Readonly<{
	children: React.ReactNode;
}>) {
	return (
		<html lang="en">
			<body>
				<WhopApp>{children}</WhopApp>
			</body>
		</html>
	);
}

Hooks

useIframeSdk

Hook to get access to the current WhopIframeSdk instance

This requires a WhopIframeSdkProvider to be mounted

import { useIframeSdk } from "@whop/react";

function ExampleComponent() {
	const iframeSdk = useIframeSdk();

	return <button onClick={function handleClick() {
		iframeSdk.openExternalUrl({ url: "https://example.com" })
	}}>Open External URL</button>
}

Components

WhopApp

One-time setup for all providers and components to build whop apps. This component handles mounting the WhopThemeScript, WhopIframeSdkProvider and Theme components.

import { type WhopIframeSdkProviderOptions } from "@whop/react";
import { WhopApp } from "@whop/react/components";

const options: WhopIframeSdkProviderOptions = {
	// your Whop App ID, defaults to process.env.NEXT_PUBLIC_WHOP_APP_ID
	appId: process.env.WHOP_APP_ID,
};

export default function RootLayout() {
	return (
		<html>
			<WhopApp sdkOptions={options}>{children}</WhopApp>
		</html>
	);
}

WhopThemeScript

The WhopThemeScript component provides a simple script that ensures your page is loading in the same theme as the main whop.com host is loaded in. It will update the documentElement to add a dark class name for dark mode and will skip adding anything for light mode.

To ensure no flash of unstyled content happens you need to mount this script as far up the html tree as possible and execute it before any elements are rendered into the DOM.

import { WhopThemeScript } from "@whop/react";

export default function RootLayout() {
	return (
		<html>
			<head>
				<WhopThemeScript />
			</head>
			{...}
		</html>
	);
}

WhopIframeSdkProvider

The WhopIframeSdkProvider is a context provider that initializes and provides and iframe SDK to all child components via the useIframeSdk hook.

import { WhopIframeSdkProvider, type WhopIframeSdkProviderOptions } from "@whop/react";

const options: WhopIframeSdkProviderOptions = {
	// your Whop App ID, defaults to process.env.NEXT_PUBLIC_WHOP_APP_ID
	appId: process.env.WHOP_APP_ID,
};

export default function RootLayout({
	children,
}: Readonly<{
	children: React.ReactNode;
}>) {
	return (
		<html>
			<body>
				<WhopIframeSdkProvider options={options}>{children}</WhopIframeSdkProvider>
			</body>
		</html>
	);
}

Note that if you are storing your app ID in NEXT_PUBLIC_WHOP_APP_ID you do not need to provide any options to the WhopIframeSdkProvider

WhopCheckoutEmbed

Breaking: The react implementation of the checkout embed is now exported from @whop/checkout/react for better react version compatibility.

React frameworks

Next.js

withWhopAppConfig

This package exports a config wrapper for your next.config.{js,mjs,ts} file that handles setting up server action allowed origins as well as import optimizations for @whop/react/components

import type { NextConfig } from "next";
import { withWhopAppConfig } from "@whop/react/next.config";

const nextConfig: NextConfig = {
	/* your config options here */
	images: {
		remotePatterns: [{ hostname: "**" }],
	},
};

export default withWhopAppConfig(nextConfig);