1.0.5 • Published 3 years ago

react-method-link v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

react-method-link

NPM

Install

npm install --save react-method-link

Usage

import React from 'react';
import { useMethodLink } from 'react-method-link';

const App = () => {
  const myAPIClient = {
    exchangeLinkToken: (data) => {},
    generateLinkToken: (options) => {},
  };

  const { openWithToken } = useMethodLink({
    env: 'sandbox', // Defaults to 'sandbox'. Use 'production' when you're ready to go live.
    onOpen: () => {},
    onExit: () => {},
    onError: (error) => {},
    onSuccess: data => myAPIClient.exchangeLinkToken(data),
  });
  
  const onClick = async () => {
    const token = await myAPIClient.generateLinkToken({});
    openWithToken(token);
  };

  return (
    <div>
      <header>
        <button type="button" onClick={onClick}>
          Open Method Link
        </button>
      </header>
    </div>
  );
};
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago