bitbox-api 0.12.0

A library to interact with BitBox hardware wallets
Documentation
// SPDX-License-Identifier: Apache-2.0

import * as bitbox from 'bitbox-api';
import { ErrorNotification } from './ErrorNotification';
import { useEffect, useState } from 'react';

export function ShowError({ err }: { err?: bitbox.Error }) {
  const [error, setError] = useState<bitbox.Error>();

  useEffect(() => {
    setError(err);
  }, [err]);

  if (error === undefined) {
    return null;
  }

  return (
    <ErrorNotification
      message={error.message}
      code={error.code}
      onClose={() => setError(undefined)}
    />
  );
}