@cohostvip/cohost-react
TypeScript icon, indicating that this package has built-in type declarations

0.1.17 • Public • Published

@cohostvip/cohost-react

React bindings for the Cohost API, built on top of @cohostvip/cohost-node.

Use this package to easily connect your React or Next.js app to Cohost's event and order APIs using a provider/hook pattern.


📦 Installation

pnpm add @cohostvip/cohost-react

Or with npm:

npm install @cohostvip/cohost-react

🚀 Usage

Wrap your app (or part of it) in the CohostProvider and use the useCohost() hook to access the API client.

Example

// app.tsx or layout.tsx
import { CohostProvider } from '@cohostvip/cohost-react';

export function App() {
  return (
    <CohostProvider token="your-api-token">
      <MyComponent />
    </CohostProvider>
  );
}
// inside your component
import { useCohost } from '@cohostvip/cohost-react';

function MyComponent() {
  const cohost = useCohost();

  useEffect(() => {
    cohost.events.list().then(console.log);
  }, []);

  return <div>Loaded events</div>;
}

🔐 Auth

Pass your API token to the CohostProvider. This token is required for all authenticated requests.
You can optionally pass:

  • baseUrl — override the default API URL (e.g. for staging)
  • debug — enable console debugging of API requests

📘 API Reference

This wrapper gives you access to the full Cohost API as defined in @cohostvip/cohost-node.
See its documentation for available methods like:

  • client.events.list()
  • client.orders.fetch(orderId, userId)
  • etc.

✅ Requirements

  • React 18 or 19
  • Next.js 14 or 15

🗒️ Changelog

See the latest changes here.


🚧 Roadmap

Planned features and improvements are tracked here.


🛠️ Support

If you're building something custom or need help integrating, reach out at cohost.vip or open an issue.

Package Sidebar

Install

npm i @cohostvip/cohost-react

Weekly Downloads

21

Version

0.1.17

License

MIT

Unpacked Size

35 kB

Total Files

47

Last publish

Collaborators

  • segevs