tokenbridge-burner-wallet-p.../my-plugin/src/ui/MyElement.tsx

24 lines
580 B
TypeScript
Raw Normal View History

2019-10-30 22:24:45 -07:00
import React, { useEffect, useState } from 'react';
2019-10-30 22:11:56 -07:00
import { BurnerContext } from '@burner-wallet/types';
2019-10-30 22:24:45 -07:00
import MyPlugin from '../MyPlugin';
const MyElement: React.FC<BurnerContext> = ({ plugin }) => {
const [block, setBlock] = useState<string | null>(null);
const _plugin = plugin as MyPlugin;
useEffect(() => {
_plugin.getBlockNum().then((num: string) => setBlock(num))
}, []);
2019-10-30 22:11:56 -07:00
return (
<div>
2019-10-30 22:24:45 -07:00
<div>Injected plugin element</div>
{block && (
<div>Current block number: {block}</div>
)}
2019-10-30 22:11:56 -07:00
</div>
);
};
export default MyElement;