0.1.14 • Published 11 months ago

@cohostvip/cohost-react v0.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
11 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

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

12 months ago

0.1.10

12 months ago

0.1.9

12 months ago

0.1.8

12 months ago

0.1.7

12 months ago

0.1.6

12 months ago

0.1.5

12 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago