React hook to integrate Pluggy Connect.
npm install --save use-pluggy-connector
pnpm install --save use-pluggy-connector
yarn add use-pluggy-connector
bun install --save use-pluggy-connectimport React, { useCallback } from 'react'
import usePluggyConnect from 'use-pluggy-connect'
const App = () => {
const handleEvent = useCallback((payload) => {
console.log(`[Event]: ${payload}`)
}, [])
const { init, error, ready } = usePluggyConnect({
url: 'https://connect.pluggy.dev',
connectToken: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IJ9...',
onEvent: handleEvent,
})
if (!ready) {
return <div>Loading...</div>
}
if (error) {
return <div>Error: {error.message}</div>
}
return (
<div>
<button onClick={init}>Init</button>
</div>
)
}
export default App'use client'
import usePluggyConnect from 'use-pluggy-connect'
export default function OpenPluggyButton() {
const { init } = usePluggyConnect({
connectToken:
'...',
})
return <button onClick={init}>Open Pluggy</button>
}usePluggyConnect accepts all PluggyConnectProps from pluggy-connect-sdk. Notable options:
| Property | Description | Type | Default |
|---|---|---|---|
connectToken |
Your Pluggy Connect token (required). | string |
N/A |
connectorSortAlphabetically |
If set to true, connectors will be sorted alphabetically (A-Z) instead of by usage. |
boolean |
false |
onSuccess |
Called when an Item has been created/updated successfully. | (data: { item: Item }) => void |
No op |
onError |
Called on errors. | (error: { message: string }) => void |
No op |
onEvent |
Called for specific user interaction events. | (payload: ConnectEventPayload) => void |
No op |
- Add tests
- Improve examples