@shophost/react-sdk v0.0.24
@shophost/react-sdk
A React SDK for integrating Shophost e-commerce functionality into your applications.
Installation
npm install @shophost/react-sdk
# or
yarn add @shophost/react-sdk
# or
pnpm add @shophost/react-sdk
Dependencies
This library uses external dependencies that will be automatically installed when you install the package. The main dependencies include:
- React 18+ (peer dependency)
- @tanstack/react-query for data fetching
- @radix-ui components for UI primitives
- Various utility libraries (clsx, tailwind-merge, etc.)
All dependencies are listed in the package.json and will be installed alongside the library when you install it in your project.
Usage
import { CartProvider, ShophostProvider, useCart } from "@shophost/react-sdk";
function App() {
return (
<ShophostProvider apiUrl="https://api.shophost.com">
<CartProvider organizationId="your-org-id">
<YourApp />
</CartProvider>
</ShophostProvider>
);
}
function YourApp() {
const { items, addItem, removeItem } = useCart();
// Your app logic here
return <div>{/* Your components */}</div>;
}
Development
This library is built with Vite and uses external dependencies (not bundled). When you install this library in another project, all the dependencies will be resolved from your project's node_modules, ensuring proper tree-shaking and avoiding duplicate bundles.
Build
pnpm nx build react-sdk
Running unit tests
Run nx test react-sdk
to execute the unit tests via Vitest.
9 days ago
14 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
17 days ago
18 days ago
18 days ago
18 days ago
18 days ago
23 days ago
23 days ago
23 days ago
23 days ago
24 days ago
24 days ago