React bindings for Swish SDK
npm install @swishapp/reactLightweight React/Preact bindings for the Swish SDK.
Use Swish’s features directly in your React app with simple hooks and a provider-based setup.
``bash`
npm install @swishapp/reactor
yarn add @swishapp/reactor
pnpm add @swishapp/react
`tsx
import { SwishProvider } from "@swishapp/react";
const config = {
// your Swish SDK config
};
function App() {
return (
);
}
`
`tsx
import { useSwishItem } from "@swishapp/react";
interface SaveButtonProps {
productId: string;
variantId?: string;
}
export function SaveButton({ productId, variantId }: SaveButtonProps) {
const { saved, toggle, loading } = useSwishItem({
productId,
variantId,
});
return (
);
}
``
Full documentation, examples, and API reference are available at:
👉 https://swish.app/docs/react