@tryvital/vital-link
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published

React Vital Link

React hooks and components for integrating with the Vital Link.

Install

With npm:

npm i @tryvital/vital-link

With yarn

yarn add @tryvital/vital-link

Documentation

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;

Package Sidebar

Install

npm i @tryvital/vital-link

Weekly Downloads

75

Version

0.1.7

License

MIT

Unpacked Size

50.5 kB

Total Files

20

Last publish

Collaborators

  • itachi_eu
  • andersatvital
  • maithd