import { useState, useEffect } from 'react' import {GreetService} from "../bindings/changeme"; import {Events, WML} from "@wailsio/runtime"; function App() { const [name, setName] = useState(''); const [result, setResult] = useState('Please enter your name below 👇'); const [time, setTime] = useState('Listening for Time event...'); const doGreet = () => { let localName = name; if (!localName) { localName = 'anonymous'; } GreetService.Greet(localName).then((resultValue: string) => { setResult(resultValue); }).catch((err: any) => { console.log(err); }); } useEffect(() => { Events.On('time', (timeValue: any) => { setTime(timeValue.data); }); // Reload WML so it picks up the wml tags WML.Reload(); }, []); return (
Wails logo React logo

Wails + React

{result}
setName(e.target.value)} type="text" autoComplete="off"/>

Click on the Wails logo to learn more

{time}

) } export default App