import { useEffect, useState } from 'react' import { DevtoolsEventClient } from './eventClient.ts' export default function CustomDevtoolPanel() { const [state, setState] = useState< { count: number; history: Array } | undefined >() useEffect(() => { // subscribe to the emitted event const cleanup = DevtoolsEventClient.on('counter-state', (e) => setState(e.payload), ) return cleanup }, []) return (
counter state: {state?.count}
counter history: {JSON.stringify(state?.history)}
) }