@publicsquare/elements-react
v1.2.1
Published
PublicSquare React Elements
Downloads
33
Readme
PublicSquare React Elements
A thin React wrapper for PublicSquare JavaScript Elements SDK.
Installation
Using Node Package Manager
npm install --save @publicsquare/elements-react
Using Yarn
yarn add @publicsquare/elements-react
Documentation
For a complete list of options and examples, please refer to our React Elements SDK docs
Usage
Initialization
Initializing the SDK is done via calling the usePublicSquare
hook with parameters:
import {
PublicSquareProvider,
CardElement,
usePublicSquare,
} from '@publicsquare/publicsquare-react';
const App = () => {
return (
<PublicSquareProvider apiKey={apiKey}> // Publishable API Key
<MyComponent />
</PublicSquareProvider>
);
};
const MyComponent = () => {
const { publicSquare } = usePublicSquare();
return <CardElement id="cardInput" />;
};