From d961a1595c0bad7a0f61685c52a7207d7679e667 Mon Sep 17 00:00:00 2001 From: Jack Baron Date: Thu, 9 Nov 2023 14:03:49 +0000 Subject: [PATCH] change return signature of renderUI --- src/react/render.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/react/render.tsx b/src/react/render.tsx index 263b83b..1bb0092 100644 --- a/src/react/render.tsx +++ b/src/react/render.tsx @@ -15,15 +15,17 @@ export const renderUI = ( game: Game, ui: ReactNode, container?: HTMLDivElement, -): (() => void) => { +): { unmount(): void } => { const div = container ?? document.createElement('div') game.client.ui.add(div) const root = createRoot(div) root.render({ui}) - return () => { - game.client.ui.remove(div) - root.unmount() + return { + unmount: () => { + game.client.ui.remove(div) + root.unmount() + }, } }