React hook to integrate Pluggy Connect.
npm install --save use-pluggy-connect
or
pnpm install --save use-pluggy-connect
or
yarn add use-pluggy-connect
or
bun install --save use-pluggy-connect
import 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>
}
- Add tests
- Improve examples