Package Exports
- @tryvital/vital-link
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tryvital/vital-link) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Vital Link
React hooks and components for integrating with the Vital Link.
Install
With npm:
npm i @tryvital/vital-linkWith yarn
yarn add @tryvital/vital-linkDocumentation
The official Vital Link docs provide a full reference on using this library.
Examples
Using React hooks
import React, { useCallback } from 'react';
import { useVitalLink } from '@tryvital/vital-link';
const App = () => {
const onSuccess = useCallback((metadata) => {
// send token to server
}, []);
const config = { onSuccess }
const { open, ready, error, env: "sandbox" } = useVitalLink(config);
const handleVitalOpen = async () => {
setLoading(true);
const GENERATED_LINK_TOKEN = await getTokenFromBackend(userKey);
open(GENERATED_LINK_TOKEN);
setLoading(false);
};
return (
<button
type="button"
className="button"
onClick={handleVitalOpen}
disabled={isLoading || !ready}
>
Open Vital Link
</button>
);
};
export default App;