29 lines
740 B
TypeScript
29 lines
740 B
TypeScript
import { fw } from '@entityseven/rage-fw-browser'
|
|
import { useEffect, useState } from 'react'
|
|
|
|
function App() {
|
|
const [data, setData] = useState('initial')
|
|
|
|
useEffect(() => {
|
|
fw.event.register('customBrowserEvent', async message => {
|
|
setData(p => p + ' | ' + message)
|
|
|
|
const response = await fw.event.triggerServer('customServerEvent', [
|
|
'hello from browser',
|
|
])
|
|
setData(p => p + ' | ' + response)
|
|
|
|
return 'response from browser'
|
|
})
|
|
}, [])
|
|
|
|
return (
|
|
<div style={{ width: '100%', color: 'white', textAlign: 'center' }}>
|
|
<h1>Hello World!</h1>
|
|
<h2>{data}</h2>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default App
|