0.1.14 • Published 5 months ago

@cohostvip/cohost-react v0.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@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.

0.1.14

5 months ago

0.1.13

5 months ago

0.1.12

5 months ago

0.1.11

6 months ago

0.1.10

6 months ago

0.1.9

6 months ago

0.1.8

6 months ago

0.1.7

6 months ago

0.1.6

6 months ago

0.1.5

6 months ago

0.1.4

6 months ago

0.1.3

6 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago

0.0.12

6 months ago

0.0.11

6 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago