diff --git a/examples/web/react/app.tsx b/examples/web/react/app.tsx index ed6b8eacd5d05d5b4d87917f947f4c0d701bc03c..27f27484a5077017473cd211b8881337841374fd 100644 --- a/examples/web/react/app.tsx +++ b/examples/web/react/app.tsx @@ -110,7 +110,12 @@ export const App = () => { }; export const startApp = (element: string) => { - const root = ReactDOM.createRoot(document.getElementById(element)!); + const elementRef = document.getElementById(element); + if (!elementRef) { + return; + } + + const root = ReactDOM.createRoot(elementRef); root.render(<App />); };