import '../lib/polyfill.js' import * as gui from 'gui' import { Suspense, lazy, useState } from 'react' import { render } from '../lib/react-qw/index.js' gui.RegisterClass('LazyTest', (hwnd, msg, wParam, lParam) => { if (!hwnd) return gui.DefWindowProc(hwnd, msg, wParam, lParam) if (msg === gui.WmMsg.DESTROY) { gui.PostQuitMessage(0) return 0 } return gui.DefWindowProc(hwnd, msg, wParam, lParam) }) function SimpleComponent() { return ( ) } const LazySimple = lazy(async () => { await new Promise(r => setTimeout(r, 500, undefined)) return { default: SimpleComponent } }) function App() { const [show, setShow] = useState(false) return ( { if (e.msg === 0x0202) setShow(!show) }} /> {show && ( }> )} ) } const hwnd = gui.CreateWindow( 'LazyTest', 'React.lazy Test', gui.WindowStyle.OVERLAPPEDWINDOW, 200, 200, 400, 300, null, null ) if (hwnd) { gui.ShowWindow(hwnd) render(, hwnd) }