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

24 lines
605 B
TypeScript
Raw Normal View History

2019-10-30 22:24:45 -07:00
import React, { useEffect, useState } from 'react';
2019-10-31 07:29:32 -07:00
import { PluginElementContext } from '@burner-wallet/types';
2019-10-30 22:24:45 -07:00
import MyPlugin from '../MyPlugin';
2019-10-31 07:29:32 -07:00
const MyElement: React.FC<PluginElementContext> = ({ plugin }) => {
2019-10-30 22:24:45 -07:00
const [block, setBlock] = useState<string | null>(null);
const _plugin = plugin as MyPlugin;
useEffect(() => {
2020-03-20 11:15:08 -07:00
_plugin.getBlockNum().then((num: number) => setBlock(num.toString()))
2019-10-30 22:24:45 -07:00
}, []);
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;